This is a migrated thread and some comments may be shown as answers.

Hiding the dropdown arrow on the Angular ComboBox

5 Answers 2462 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jimmy
Top achievements
Rank 1
Jimmy asked on 17 Aug 2019, 05:27 PM
I need to hide the DropDown arrow on an Angular ComboBox so that it will function as an Autocomplete.  I can not use the AutoComplete control as I need to send in an id which is a number and the AutoComplete only supports strings.  If I can solve either of these issues I would be a happy camper :)

5 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 19 Aug 2019, 07:57 AM
Hi Jimmy,

Indeed, the AutoComplete supports string values only. The most straight-forward approach to hide the dropdown arrow of the ComboBox is via CSS:

encapsulation: ViewEncapsulation.None,
  styles: [`
    .k-combobox .k-dropdown-wrap .k-select {
      display: none;
    }
 
    .k-combobox .k-dropdown-wrap .k-clear-value {
      right: 8px;
    }
  `]

https://stackblitz.com/edit/angular-y1piaa?file=app/app.component.ts

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik
Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jimmy
Top achievements
Rank 1
answered on 19 Aug 2019, 04:09 PM
Thank you so much Dimiter.  That worked perfectly.
0
Zhenyong
Top achievements
Rank 2
answered on 06 Aug 2020, 03:04 PM

Hi Dimiter,

I got into the same problem and tried out your solution. I found out that ViewEncapsulation.None will affect other combo box in the app. How can I set the style on one isolated component only?

 

0
Dimiter Topalov
Telerik team
answered on 07 Aug 2020, 07:38 AM

Hello Zhenyong,

To scope the custom styling to one or several selected components only, add a custom class to each of them, and scope the custom styling CSS selector to this class, for example:

https://stackblitz.com/edit/angular-y1piaa-lm9jyd?file=app/app.component.ts

Regards,
Dimiter Topalov
Progress Telerik

0
Zhenyong
Top achievements
Rank 2
answered on 07 Aug 2020, 01:50 PM
Thanks for your suggestion. It solved my problem!
Tags
ComboBox
Asked by
Jimmy
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Jimmy
Top achievements
Rank 1
Zhenyong
Top achievements
Rank 2
Share this question
or