value

Gets or sets the value of the DropDownTree.

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.

<input id="dropdowntree" />

<script>
    $("#dropdowntree").kendoDropDownTree({
        dataSource: [{ text: "Item1", value: 1 }, { text: "Item2", value: 2 } ],
    });

    var dropdowntree = $("#dropdowntree").data("kendoDropDownTree");

    dropdowntree.value("2");
    dropdowntree.trigger("change");
</script>

Parameters

value Array|String

The value to set. A String value, when checkboxes is 'false', and an Array of items of the value field type (number or string), when checkboxes is true. To clear the value, pass an empty array.

Returns

Array The value of the DropDownTree.

Example - set value

<input id="dropdowntree" />

<script>
    $("#dropdowntree").kendoDropDownTree({
        dataSource: [{ text: "Item1", value: 1 }, { text: "Item2", value: 2 }],
        checkboxes:true
    });

    var dropdowntree = $("#dropdowntree").data("kendoDropDownTree");

    // set the value of the dropdowntree
    dropdowntree.value([1, 2]); //select items which have value respectively 1 and 2

    // get the value of the dropdowntree
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(dropdowntree.value());
</script>
In this article