Home Forums Presentation Controls Is it possible to traverse and select a node in a Tree?

Viewing 4 reply threads
  • Author
    Posts
    • #7579
      Spencer WallsworthSpencer Wallsworth
      Participant

      Hello,

      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
    • #7591
      norairnnorairn
      Participant

      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
    • #7599
      Spencer WallsworthSpencer Wallsworth
      Participant

      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
      ((bind’getValue model)’:oid))

      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
    • #7611
      norairnnorairn
      Participant

      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
    • #7649
      Spencer WallsworthSpencer Wallsworth
      Participant

      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
Viewing 4 reply threads
  • You must be logged in to reply to this topic.