最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to modify KendoUI DropDownList items - Stack Overflow

programmeradmin2浏览0评论

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

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

Share Improve this question asked Apr 26, 2012 at 15:54 dasheddotdasheddot 2,9664 gold badges27 silver badges33 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 19

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"});
发布评论

评论列表(0)

  1. 暂无评论