valueTemplate String|Function

The template used to render the value and the or the selected tags.

Example - specify template as a function

<input id="dropdowntree" />
<script id="valueTemplate" type="text/x-kendo-template">
    <img src="/img/#: id #.png" alt="#: name #" />
    #: name #
</script>
<script>
$("#dropdowntree").kendoDropDownTree({
  dataSource: [
    { id: 1, name: "Apples" },
    { id: 2, name: "Oranges" }
  ],
  dataTextField: "name",
  dataValueField: "id",
  valueTemplate: kendo.template($("#valueTemplate").html())
});
</script>

Example - specify template as a string

<input id="dropdowntree" style="width: 400px;" />
<script>
    $("#dropdowntree").kendoDropDownTree({
        dataSource: [
            { id: 1, name: "Apples" },
            { id: 2, name: "Oranges" }
        ],
        dataTextField: "name",
        dataValueField: "id",
        valueTemplate: '<span><img src="/img/#: id #.png" alt="#: name #" />#: name #</span>'
    });
</script>
In this article
Not finding the help you need? Improve this article