I\'m running Primefaces 3.2 and JSF 2.0 on Glassfish 3.
I\'ve tried a lot, to programatically set the selected node from a managed bean. That includes setting the se
In the above if statement, when true, do a node.setSelected(true);
I use that to set nodes on as required. The reverse obviously has the reverse effect; it turns them off. My use case has been a boolean check box to turn all nodes on or off as I have quite a few running down the side of a tree. My actual code, involving a few methods, is therefore:-
public Boolean getSelectionState() {
return selectionState;
}
public void setSelectionState(Boolean selectionState) {
this.selectionState = selectionState;
}
public String getSelectLabel() {
return selectionState ? "De-select all" : "Select all";
}
/**
* Flips all nodes on or off depending on checkbox.
*/
public void onSelectChange() {
if (prefs.isDebug()) {
LOG.log(Level.INFO, "Value change event occured. Selection state is:{0}", selectionState);
}
for (TreeNode node : rootNode.getChildren()) {
node.setSelected(selectionState);
}
nodes = new ArrayList(rootNode.getChildren());
selectedNodes = nodes.toArray(new TreeNode[nodes.size()]);
mapDevices();
}
I am however, using 3.4 on JSF 2 on GF 3. I don't know if there is a difference.
Regs
Tim