admin 管理员组文章数量: 1086019
I can remove all items except the last one from the kendo dropdownlist. After the last one is removed, the previous items reappear.
Here is a jsFiddle: /
var dropDown = $("select").data("kendoDropDownList");
var itemToRemove = dropDown.dataSource.at(0);
dropDown.dataSource.remove(itemToRemove);
dropDown.select(0);
Any ideas how to solve this?
I can remove all items except the last one from the kendo dropdownlist. After the last one is removed, the previous items reappear.
Here is a jsFiddle: http://jsfiddle/lpoellabauer/Jw4Cz/
var dropDown = $("select").data("kendoDropDownList");
var itemToRemove = dropDown.dataSource.at(0);
dropDown.dataSource.remove(itemToRemove);
dropDown.select(0);
Any ideas how to solve this?
Share Improve this question asked Apr 30, 2012 at 11:17 l.poellabauerl.poellabauer 7563 gold badges11 silver badges18 bronze badges1 Answer
Reset to default 4HTML:
<select>
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
<option id="none" value="none"></option>
</select>
<a href="#">remove first</a>
JS:
$("select").kendoDropDownList();
$("a").click(function(){
var dropDown = $("select").data("kendoDropDownList");
var itemToRemove = dropDown.dataSource.at(0);
dropDown.dataSource.remove(itemToRemove);
dropDown.select(0);
});
$('none').css({display:none});
本文标签: javascriptHow to remove item of kendo dropDownList if it is the last oneStack Overflow
版权声明:本文标题:javascript - How to remove item of kendo dropDownList if it is the last one? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744071539a2528578.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论