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.
This converter implementation might help you find a way:
I assume you could achieve what you want by using rowKeyConverter and selection attribute.
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:
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.
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.