template String|Function
The template used to render the items. By default the widget displays only the text of the data item (configured via dataTextField
).
Example - specify template as a string literal
<input id="dropdownlist" />
<script>
let encode = kendo.htmlEncode;
$("#dropdownlist").kendoDropDownList({
dataSource: [
{ id: 1, name: "Apples" },
{ id: 2, name: "Oranges" }
],
dataTextField: "name",
dataValueField: "id",
template: ({ id, name }) => `<span>${name}</span>`
});
</script>