Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get selected values of Kendo Multi Select?

I'm using Kendo multi select as follow but i can't get selected values

var multiselect = $("#SelectRoles").data("kendoMultiSelect");
var selectedData= [];
var items = multiselect.value();
for (var itm in items)
{
   selectedData.push(itm);
}

but array selectedData return indices of items in multiselect not values .

like image 992
Omar Seleim Avatar asked Jan 15 '17 18:01

Omar Seleim


1 Answers

You can also assign the array, returned from the value() method, directly to the variable, e.g.:

var ms = $("#multiselect").kendoMultiSelect({
  value: ["1", "2"]
}).data('kendoMultiSelect');

var selectedItems = ms.value();
console.log(selectedItems); // ["1", "2"]
like image 96
topalkata Avatar answered Oct 05 '22 23:10

topalkata