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

Combobox and noDataTemplate

1 Answer 200 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Torben Pape-Haugaard
Top achievements
Rank 1
Torben Pape-Haugaard asked on 27 Jan 2017, 09:28 AM

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?

1 Answer, 1 is accepted

Sort by
0
Accepted
Boyan Dimitrov
Telerik team
answered on 31 Jan 2017, 08:11 AM

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.
Tags
ComboBox
Asked by
Torben Pape-Haugaard
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or