onItemRequest - event of the PmfTree object
Description:
The event is triggered with request to create subitems for dynamic tree item.
Parameters:
ev.SrcObject | (Object) Pmf object where the event originated. |
ev.Item | (Object) Tree item (PmfTreeItem object) for which the request to create subitems was made. |
---|
Note:
This event is is functional only in
JavaScript language.
The event is triggered when the dynamic tree item (see
RequestType) is expanded by mouse, keyboard, or by calling the methods
GetItem and
SetExpanded.
This event is not triggered when the dynamic tree item is expanded by calling the methods
SetSel or
SetVisible.
Example:
JavaScriptSelect and copy to clipboard
var oForm = pMe.Form;
var oTree = oForm.CreateItem("tree", "id_tree1");
var oRoot = oTree.TreeRoot;
oRoot.CreateItem("item1", null, "RequestType:1;");
oRoot.CreateItem("item2", null, "RequestType:1;");
// ... Additional tree settings
// The function is registered into the onItemRequest event.
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 TreeItemId=" + ev.Item.Id);
}
}
oTree.AddEvent("onItemRequest", "Id_Request", onTreeItemRequest);