Search code examples
javascriptjquerykendo-multiselect

Get all values of Kendo multiselect on selecting "ALL" Option


var SelectedMapTypes = $("#msMapType").data("kendoMultiSelect")

This is my Kendo Multiselect.

i need to get all the multiselect values when i click ALL from the multiselect.

Please help.

Datasource : Populating from database.


Solution

  • If you want to select all values in the multiselect (when "All" selected), you can use:

    select: function(e) {
        var dataItem = this.dataSource.view()[e.item.index()];
    
        var values = dataItem.value === "ALL" ? 
            $.map(this.dataSource.data(), function(dataItem) {
                return dataItem.value;
            }) 
            : this.value();
    
        this.value(values); // values holds all items within the multiselect
    
    }
    

    Dojo Example