Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Count/Length/Size of Kendo UI DropDownList

I am tring to get count of Kendo UI DropDownList but I am not getting right value. By taking count of Kendo UI, I want to remove last item from Kendo DropDownList. I tried following but not working:

1.

var dropDown = $("#RoleDrp").data("kendoDropDownList");
var len = dropDown.value().length+1;
var itemToRemove = dropDown.dataSource.at(len);
dropDown.dataSource.remove(itemToRemove);
dropDown.select(0);

I am getting length as 6 but I have total 13 items in DropDownList.

2.

var len = dropDown.length;

I am getting undefined.

like image 210
Dhwani Avatar asked Dec 05 '22 06:12

Dhwani


1 Answers

hey try this code to get length of kendo dropdown list:-

var dropDown = $("#RoleDrp").data("kendoDropDownList");
var len =dropDown.dataSource.data().length;
alert(len);

Thanks

like image 109
Devendra Soni Avatar answered Dec 09 '22 13:12

Devendra Soni