-
1. Re: reset tree state
mmichalek Jan 3, 2008 2:26 AM (in response to jmiguel77)I have a similar question: is there a way to reset a tree's selection through javascript? For example, I would like to de-select the selected tree node when the user selects an item from another list on the same page.
For the general question of resetting the tree: I'm not sure if there is a way to have this done automatically, but this code will reset the tree expansion and selection server-side:public void processSelection(NodeSelectedEvent event) { UITree tree = (UITree) event.getComponent(); selected = (IOrgScope) tree.getRowData(); TreeState state = (TreeState )tree.getComponentState(); state.setSelected(null); try { state.collapseAll(tree); } catch (IOException ex) { ... } }
-
2. Re: reset tree state
nbelaevski Jan 3, 2008 11:37 AM (in response to jmiguel77)I've create RFC for JS tree selection API: http://jira.jboss.com/jira/browse/RF-1820. It is possible to reset selection for now using existing toggleSelection method of Tree.Item class, however that's still a hack. See ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js for more info
-
3. Re: reset tree state
jmiguel77 Jan 3, 2008 11:59 AM (in response to jmiguel77)thanks for the help
i had some trouble finding the component, but that is another tale :)
i hope the "reset" method for javascript would be soon available
if someone has an example, that would be great too -
4. Re: reset tree state
alespio Nov 11, 2008 5:11 AM (in response to jmiguel77)"nbelaevski" wrote:
I've create RFC for JS tree selection API: http://jira.jboss.com/jira/browse/RF-1820. It is possible to reset selection for now using existing toggleSelection method of Tree.Item class, however that's still a hack. See ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js for more info
Sorry nbelaevski, could you paste some sample code showing that scripts works?
Thanks