How to modify KendoUI DropDownList items
13,402
Yo mate
You should use the dataSource of the combobox. e.g.
var ds = $('#YourCombo').data().kendoComboBox.dataSource;
then you can modify the items like this
//someIndex is the index of the item in the dataSource
ds.data()[someIndex].set("text","Cool! its changed");
to add item or remove use the add and remove methods of the dataSource
ds.add({text:"Test again!",value:"5"});
Author by
dasheddot
Updated on July 17, 2022Comments
-
dasheddot almost 2 years
We used the Kendo UI DropDownList the first time without binding with knockout. Via jquery a usual html input is transformed into a KendoUI DropDownList. But how can i remove/edit/add items to the options?
If i modify the html inputs options via jquery it has no influence on the kendoui dropdown - even with a refresh call afterwards.
Any ideas how to do this? Thanks
-
theycallmemorty over 11 yearsOP was actually asking about a kendoDropDownList but I've found that this method works just as well for DropDownLists as it does for ComboBoxes
-
Kala J over 9 yearsIn this case, what would I define as my datasource? do I need a datasource?