Next bug with Tree 2.0.2
Posted: 26 May 2010, 16:17
Hi,
The next bug with the tree component in the current release is an empty selection if we click twice on the same tree node. The first click is ok. For second click we have empty params.get(selectionParam). See decode() method in the TreeRenderer
For the second click on the same node we have tree.setSelection(new TreeNode[0]);
The next bug with the tree component in the current release is an empty selection if we click twice on the same tree node. The first click is ok. For second click we have empty params.get(selectionParam). See decode() method in the TreeRenderer
Code: Select all
if(params.containsKey(selectionParam)) {
String selectedNodesValue = params.get(selectionParam);
if(selectedNodesValue.equals(""))
tree.setSelection(new TreeNode[0]);
else {
String[] selectedRowKeys = selectedNodesValue.split(",");
TreeNode[] selectedNodes = new TreeNode[selectedRowKeys.length];
TreeModel model = new TreeModel((TreeNode) tree.getValue());
for(int i = 0 ; i < selectedRowKeys.length; i++) {
selectedNodes[i] = treeExplorer.findTreeNode(selectedRowKeys[i], model);
model.setRowIndex(-1); //reset
}
tree.setSelection(selectedNodes);
}
}