-
1. Re: problems selecting a node of a tree from code
bleathem May 24, 2013 2:32 AM (in response to agallo73)You could try using the compnentControl component to select a tree node using the javascript API of the tree.
-
2. Re: problems selecting a node of a tree from code
agallo73 May 24, 2013 3:30 AM (in response to bleathem)Sorry but how can i do it from javascript if I need to perform a search from the bean on the tree and then select the node that meet search criteria? Is there some way to access th tree model and get the modelId i mentioned in my post? Otherwise is there some way to define a criteria for SequenceRowKey (rowKeyConverter or something else..) ? I am using a TreeModelRecursiveAdaptor and I have to populate the selection attribute with a collection of these objects. The problem is that these objects are strictly related to the framework's internals and so I can not immagine how could be possible to provide these SequenceRowKey in a correct way and do not understand why you provide these ways of selecting nodes without any direct method in the UITree component. I also tried to acces the TreeModel but this method is protected in the UITree class... nor the TreeModelRecursiveAdaptor gives me any info as far as my problem
Coming back to my case,
I saw that when selecting a node, the framework creates an array of DeclarativeModelKey objects, one for each descending node of the tree (starting from top) and each having a modelID and a modelKey.
Can you please tell me if it's possible to get the modelId in some way of these objects or show me some examples on how to use selection in a tree with a TreemodelrecursiveAdaptor?
Thanks in advance.
-
3. Re: problems selecting a node of a tree from code
lfryc May 24, 2013 1:08 PM (in response to agallo73)This converter implementation might help you find a way:
I assume you could achieve what you want by using rowKeyConverter and selection attribute.
-
4. Re: problems selecting a node of a tree from code
lfryc May 24, 2013 1:12 PM (in response to lfryc)Would be actually nice to find this way and provide it as a sample in Showcase or at least components-demo.
Btw this might be simpler to achieve with tree first and tren try declarative model.
If you want a sandbox to play with, here it is:
-
5. Re: problems selecting a node of a tree from code
agallo73 Jun 1, 2013 2:23 PM (in response to lfryc)I solved the problem using my previous approach based on a sequence of DeclarativeModelKey objects.
I retrieved the modelID using a binding to the TREEModelRecursiveAdaptor and also calculated the key of each DeclarativeModelKey object, putting some logic in the bean class in order to keep track of each node position within the parent's children' list, each time it's added to the tree.
I also clearly used a selection attribute in the xhtml in order to point to the collection of SequenceRowKey objects.
-
6. Re: problems selecting a node of a tree from code
bleathem Jun 7, 2013 6:39 PM (in response to agallo73)Antonio, that's great! This seems like a common use case. How would you feel about submitting a github pull request with a dev-example demonstrating your solution? Also, if you can suggest any API improvements that would facilitate this use case, please file a feature request in jira detailing such improvements.