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

Display value in ComboBox

2 Answers 370 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Iron
Joel asked on 10 Mar 2016, 12:58 AM

I have a ComboBox that displays values and text (descriptions) in the drop-down list.  Everything works well, except I need the value to display in the textbox (input) portion of the ComboBox, not the text description.  For example, an entry contains "Jr." as the value and "Junior" as the text description.  When selected, I want the textbox to display "Jr." instead of "Junior".  How can I make this happen?  I'd like to keep the text descriptions in the drop-down if possible.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 11 Mar 2016, 04:33 PM
Hello Joel,

You can handle the change event of the Kendo UI ComboBox and set the value of the input to be the value of the widget. In order to trigger the same behavior immediately after the widget is initialized, use the dataBound event:

...
change: function(e) {
    e.sender.input.val(e.sender.value());
},
dataBound: function(e) {
    e.sender.input.val(e.sender.value());
}
...

Let me know if you need further assistance.

Regards,
Dimiter Topalov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Joel
Top achievements
Rank 1
Iron
answered on 14 Mar 2016, 03:08 PM
I failed to mention that I am using Angular, so I needed to use the cascade event rather than the change event to detect when changes are made to the model. But it is working perfectly.  Thanks for the help.
Tags
ComboBox
Asked by
Joel
Top achievements
Rank 1
Iron
Answers by
Dimiter Topalov
Telerik team
Joel
Top achievements
Rank 1
Iron
Share this question
or