Edit this page

value

Gets or sets the value of the MultiSelect.

Important: If there are no items, the value method will pre-fetch the data before continue with the value setting.

Important: The widget will clear the applied filter if a new value is set. Thus it ensures that the original/whole data set is available for selection.

Important: This method does not trigger change event. This could affect MVVM value binding. The model bound to the widget will not be updated. You can overcome this behavior by triggering the change event manually using trigger("change") method.

<select id="multiselect" multiple="multiple">
    <option>Item1</option>
    <option>Item2</option>
</select>
<script>
$("#multiselect").kendoMultiSelect();

var multiselect = $("#multiselect").data("kendoMultiSelect");

multiselect.value("Item1");
multiselect.trigger("change");
</script>

Parameters

value Array |String

The value to set. A String value or an Array of strings is accepted. To clear the value, pass an empty array.

Returns

Array The value of the MultiSelect.

Example - set value

<select id="multiselect" multiple="multiple">
    <option value="1">Item1</option>
    <option value="2">Item2</option>
</select>
<script>
$("#multiselect").kendoMultiSelect();

var multiselect = $("#multiselect").data("kendoMultiSelect");

// get the value of the multiselect.
var value = multiselect.value();

// set the value of the multiselect.
multiselect.value(["1", "2"]); //select items which have value respectively "1" and "2"
</script>

If initial items are lost in attempt to set new values, probably the widget is filtered by the end user, but no value has been selected. You will need to remove applied filter, before calling value method

Example - remove applied filter before set the value

<select id="multiselect" multiple="multiple">
    <option value="1">Item1</option>
    <option value="2">Item2</option>
</select>
<script>
$("#multiselect").kendoMultiSelect();

var multiselect = $("#multiselect").data("kendoMultiSelect");

//clear filter
multiselect.dataSource.filter({});

//set value
multiselect.value(["1", "2"]);
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy