September 23, 2016 at 6:20 pm #7579
I am trying to traverse the tree “treeHierarchy” inside the form “EntityHierarchyCo” and make a selection from a script.
Is it possible to do this?0
September 26, 2016 at 2:26 pm #7591norairnParticipant
The tree view has two API methods which you can find helpful.
1) (treeView’selection) gets a currently selected tree item view;
2) (treeView’selection selectionObject) selects a tree item. If a model, or an OID is specified as an argument, selects a tree item bound to the given model. Otherwise, if a list of OIDs is given, selects a tree item with automatic expansion of child tree items. The list of OIDs dictates the search path and must start with the OID of the root, followed by OIDs of the direct child of the previous item. The default maximum search depth is 10 levels deep.
It recommended to set tree view selection in a lambda using the (this’postMessage key lambda) API.
As with any view you can iterate through its children using the (for-each lambda view) API.0
September 26, 2016 at 6:32 pm #7599
Thank you for responding.
I can get a selection from a tree but it seems like I am unable to make one.
I tried this within EntityHierarchyPortlet dataActions :
((this’findView ‘(EntityHierarchyCo treeHierarchy))’selection
I also made an event sysSelect in EntityHierarchyCo and tried passing in the parameter.
((this’findView ‘(treeHierarchy))’selection parameter)
I keep getting:
An error occurred: Attempt to invoke an unknown method “selection” on class “ScriptedCompositeView”
There also does not seem to be a way to go to a child node from a parent node. In sysSelect I can get the selected node “source”. I can then keep calling the parent and follow up to the root. None of the models associated with each node seems to be defined.0
September 28, 2016 at 12:10 pm #7611norairnParticipant
What is the requirement you are implementing? Can you post it? I will work with you on a solution and debug if necessary.
The issue may be around the fact that the tree selection is set asynchronously. Also, if there are nodes which are loaded on demand (lazy=”true”) the API will not force them to load.0
September 29, 2016 at 11:32 am #7649
Thank you for your help,
I found an alternate way of doing things.
I took the behavior of sysContext within context-form-target and passed the current object.0
- You must be logged in to reply to this topic.