Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the count of selected items in Kendo Multi Select Control?

What is the best way to get the count of selected Items in the Kendo multi select control?

I've tried:

multiSelect.dataItems().count()

and

multiSelect.value().count()

and neither work? Any suggestions would be greatly appreciated.

like image 944
Rodney Hickman Avatar asked Nov 24 '25 03:11

Rodney Hickman


2 Answers

using multiSelect.value() will give you an array of the selected items. You can then get the .length off the array:


var count = multiSelect.value().length;

http://docs.kendoui.com/api/web/multiselect#methods-value

and

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length

like image 92
Derick Bailey Avatar answered Nov 25 '25 16:11

Derick Bailey


It might help to others

var multiSelectItems = $('#MultiselectCollection').data('kendoMultiSelect');
var count = multiSelectItems .value().length;
like image 37
Anil Singh Avatar answered Nov 25 '25 17:11

Anil Singh