Promotic
Login logon

RequestType - property of the PmfTreeItem object

Description:
The property returns or sets the request type for creating subitems of the corresponding tree item.
Syntax:
Long RequestType
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:
Creates the PmfTree object (e.g. in the onFormLoad event of the PmgForm object).
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);

History:
Pm9.00.26: Created
PROMOTIC 9.0.34 SCADA system documentation MICROSYS, spol. s r.o.

Send page remark Contact responsible person
© MICROSYS, spol. s r.o.Update cookies preferences