Using
Kendo UI: 2016.3.1202
Chrome: 56.0.2924.87
Angular: 1.5.8
Implemented a dropdownlist as specified in https://demos.telerik.com/kendo-ui/dropdownlist/addnewitem with the exception of placing my addNew() in the Kendo template.
<
script
id
=
"noDataTemplate"
type
=
"text/x-kendo-tmpl"
>
<
div
>
No data found. Do you want to add new item - '#: instance.filterInput.val() #' ?
</
div
>
<
br
/>
<
button
class
=
"k-button"
onClick
=
"addNew('#: instance.element[0].id #', '#: encodeURI(instance.filterInput.val()) #');"
>Add new item</
button
>
<
script
>
debugger
function addNew(widgetId, value) {
var widget = $("\\#" + widgetId).getKendoDropDownList();
var dataSource = widget.dataSource;
dataSource.add({
categoryID: 0,
categoryName: value
});
dataSource.one("sync", function() {
widget.select(dataSource.view().length - 1); //
});
dataSource.sync();
};
</
script
>
</
script
>
While using the new "add new item" feature, if a user types in a leading back slash (e.g. \test ) the flow of the add new functionality breaks. I can add the 'test' to the widget but the UI never sets the selected value to test, just appears blank. Adding a 'debugger;' directly above datasource.one allows me to break within this code