Combobox and noDataTemplate

2 posts, 1 answers
  1. Torben Pape-Haugaard
    Torben  Pape-Haugaard avatar
    6 posts
    Member since:
    Mar 2010

    Posted 27 Jan Link to this post

    Hello

    I want to use the new "noDataTemplate" to add new items as in this example: http://demos.telerik.com/kendo-ui/combobox/addnewitem

    If I type "custom" in the example I can then add that as a new item.

    But I can't add a new item called "Cha" because there are 3 other items starting with "cha". I know there is a conflict here: Should we show the 3 items or the add-new-item-dropdown. But do you have a solution for this problem? E.g show the add-new-item-dropdown above the input so that both can be active at the same time? Or is it not possible?

  2. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1966 posts

    Posted 31 Jan Link to this post

    Hello,

    The "noDataTemplate" is displayed when there is no data to be shown to satisfy the filter expression. In case of some data the "noDataTemplate" will not be shown at all. Having this in mind such functionality can not be achieved. 

    As a workaround I would suggest an alternative solution: 

       1. Use the Kendo UI ComboBox dataBound event to show a button next to the ComboBox on the page (or below the widget). 

       2. In order to access the DataSource of the ComboBox the dataSource property can be used. The filter method of the DataSource returns the filter information currently applied to the DataSource (if any). 

       3. The custom button will add a new item to the DataSource as shown in the  http://demos.telerik.com/kendo-ui/combobox/addnewitem demo. 

    Regards,
    Boyan Dimitrov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top