Display value in ComboBox

3 posts, 1 answers
  1. Joel
    Joel avatar
    18 posts
    Member since:
    Feb 2015

    Posted 09 Mar 2016 Link to this post

    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. Answer
    Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    440 posts

    Posted 11 Mar 2016 Link to this post

    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!
  3. Joel
    Joel avatar
    18 posts
    Member since:
    Feb 2015

    Posted 14 Mar 2016 in reply to Dimiter Topalov Link to this post

    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.
Back to Top