Items
When you bind the DropDownTree through the dataSource
configuration option, each item can acquire specific properties.
The following example demonstrates how to set the item properties of the DropDownTree. You can configure the text
, imageUrl
, spriteCssClass
, and url
fields through the datatextfield
, dataimageurlfield
, dataspritecssclassfield
, and dataurlfield
options respectively.
var item = {
text: "Item text",
value: "value",
enabled: true,
// If specified, renders the item as a link (<a href=""></a>).
url: "/",
// Renders an <img class="k-image" src="/images/icon.png" />.
imageUrl: "/images/icon.png",
// Renders a <span class="k-sprite icon save" />.
spriteCssClass: "icon save",
// Specifies whether the node text will be encoded.
// Useful when rendering node-specific HTML.
encoded: false,
// Specifies whether the item is initially expanded.
// Applicable when the item has child nodes.
expanded: true,
// Specifies whether the item checkbox is initially checked.
// Applicable for items with checkboxes which use the default checkbox template.
checked: true,
// Specifies whether the item is initially selected.
selected: true,
// Indicates the sub-items of the item.
items: [
{ text: "Subitem text" }
]
};