ItemTreeView

Version: 9.0

An ItemTreeView control displays items in a tree structure, starting from the item that you define in the RootItem property.

Users can fold and unfold the branches of the tree, select individual items, "check" items, or select multiple items.

You can specify that the ItemTreeView control displays a check box for each item. Users can only "check" items if the ItemTreeView control displays check boxes.

Selecting an item and "checking" an item are not the same in an ItemTreeView control. Items can be selected and not checked, or they can be checked and not selected. The CheckedItemIds property is a list of the IDs of all checked items, and the SelectedItemId is the ID of the currently selected item.

The branches of the tree are the folders of the path from the RootItem property to the items, and the items are the leaves. The ItemTreeView control displays branches and leaves as text and icons. It uses the name of the folder or item as the text and you can decide whether it uses Sitecore icons or generic icons.

Properties

Name

Description

Default

Behavior

ClickFolderMode

Specifies the behavior when a user clicks a folder. The options are: 1:activate, 2:expand, or 3:activate and expand.

IsCheckboxEnabled

If True, the ItemTreeView control displays a check box for each node in the tree. Users can check and uncheck nodes by clicking.

If you click a node that has children, the ItemTreeView control checks or unchecks this node as well as all child nodes.

Note

A “checked item” is not the same as a “selected item.” The ItemTreeView control updates the CheckedItemsIds property with a list of currently checked items when an item is checked or unchecked.

True

SelectMode

Specify how the user selects nodes in the tree:

  • “1”: only one node can be selected at a time. Selecting a node deselects any node that was already selected.

  • “2”: multiple nodes can be selected.

  • “3”: multihierarchal – child nodes are selected when a node is selected.

3 (multihierarchal)

ShowIconImage

If False, the ItemTreeView control does not display icon items.

True

ShowSitecoreIcons

If True, the ItemTreeView control displays item icons; if False, the ItemTreeView control displays generic icons (one for folders, another for items).

False

Data

CheckedItemIds

A pipe-separated (‘|’) read-only list of the item IDs of checked items. The ItemTreeView control updates the list when an item is checked or unchecked. This property is read-only.

PreLoadPath

Specify a path to an item that is selected when the control is rendered. You must specify the path like this: <Item ID > / <Item ID> / … The first item in this path must be the item that the RootItem property points to.

If the path has an error, the ItemTreeView control is still displayed, but nothing is selected.

RootItem

The ID of the Sitecore item the ItemTreeView control starts from.

The top of the context database content tree.

SelectedItemId

The item ID of the currently selected item. This property is read-only.

Filters

Base Templates

Specify a pipe-separated (‘|’) list of base template names. The ItemTreeView control only displays items that have these base templates.

ShowHiddenItems

If true, the ItemTreeView control displays items where the _Hidden property is True.

If you change the setting of this property at runtime (from JavaScript code), the ItemTreeView control will not use the new setting for nodes in the tree that are already expanded.

False

Template

Specify a template name. The ItemTreeView control only displays items that have this template.

Configuration

You can create a configuration item for an ItemTreeView control by creating an item based on the ItemTreeView Parameters template.

The configuration item has these specific fields:

  • RootItem

  • PreLoadPath

  • SelectedItemId

  • CheckedItemIds

  • ClickFolderMode

  • IsCheckboxEnabled

  • SelectMode

  • ShowSitecoreIcons

It inherits these fields:

  • IsVisible

  • AccessKey

  • Tooltip

  • Behaviors

  • Id

Do you have some feedback for us?

If you have suggestions for improving this article,