RequestType - property of the PmfTreeItem object
Description:
The property returns or sets the request type for creating subitems of the corresponding tree item.
Values:
0 (default) - Static tree item. If the item has subitems, then there is a button on the left side of the item that can be used to expand/collapse the item. The
onExpand event is triggered after pressing the button.
1 - Dynamic tree item. The button for expanding/collapsing the item is always displayed. After pressing the button, before the item is expanded, the
onItemRequest event is triggered.
In this event, it is possible to dynamically create new or remove existing tree subitems. Then the item is expanded and the
onExpand event is triggered.
Note:
Property access
for read and write.
This property is also functional in
Web panels.
Example1:
JavaScriptSelect and copy to clipboard
function onTreeItemRequest(ev)
{
// If the dynamic tree item was not filled, then GetItemCount method returns the -1 value.
if (ev.Item.GetItemCount() < 0)
{
ev.Item.CreateItem("subitem", null, "RequestType:1;");
Pm.Debug("PmfTree.onItemRequest, TreeItem Id=" + ev.Item.Id);
}
}
var oForm = pMe.Form;
var oTree = oForm.CreateItem("tree", "id_tree1");
var oRoot = oTree.TreeRoot;
var oTreeItem1 = oRoot.CreateItem("item1");
oTreeItem1.RequestType = 0;
// Static tree item, the subitems will be created now.
oTreeItem1.CreateItem("subitem");
var oTreeItem2 = oRoot.CreateItem("item2");
oTreeItem2.RequestType = 1;
// Dynamic tree item, the subitems will be created while expanding the item in the onItemRequest event.
// ... Additional tree settings
oTree.AddEvent("onItemRequest", "Id_Request", onTreeItemRequest);