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

javascript - Kendo UI Dropdownlist: how add new elements dynamically - Stack Overflow

programmeradmin0浏览0评论

How can I add a new item in a Kendo DropDownlist, if it doesn't exist in the datasource?

Example: the Kendo DropDownlist shows some predefined values, but the user should also be able to add a new item by writing in an input text.

How can I add a new item in a Kendo DropDownlist, if it doesn't exist in the datasource?

Example: the Kendo DropDownlist shows some predefined values, but the user should also be able to add a new item by writing in an input text.

Share Improve this question edited Oct 21, 2015 at 22:54 Nic 12.9k20 gold badges84 silver badges106 bronze badges asked Apr 4, 2015 at 10:25 TomTom 4,10725 gold badges72 silver badges107 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

You can use the add() method of the Kendo datasource to add new items:

var ddl = $("#dropDownListID").data("kendoDropDownList");
var dataSource = ddl.dataSource.add({
    "text": "new Item", 
    "value": 1000});
发布评论

评论列表(0)

  1. 暂无评论