Clear selected value(s) for Kendo multi select

Nitish picture Nitish · Nov 7, 2013 · Viewed 28.5k times · Source

I have Kendo multiSelect control which is working perfectly fine. However I am facing issue to reset its selected value. The following is what I have tried so far :

$("#Department option:selected").removeAttr("selected");  

And

var departmentMultiselect = $('#Department').data("kendoMultiSelect");
var subtract = $('#department').val();
                var values = departmentmultiselect.value().slice();
                values = $.grep(values, function (a) {
                 return $.inarray(a, subtract) == -1;
                });
                departmentmultiselect.datasource.filter({});
                departmentmultiselect.value(values);  

In the second code, control bypasses the following code

values = $.grep(values, function (a) {
                     return $.inarray(a, subtract) == -1;
                    });  

How can I reset this control?

Answer

Mekanik picture Mekanik · Mar 11, 2014

To unselect all values in kendo multiselect:

var multiSelect = $('#Department').data("kendoMultiSelect");
multiSelect.value([]);