PDA

View Full Version : [FIXED] TreeTable: setCheckNodes() is ignored



flow
23 Jun 2008, 11:15 AM
- GXT 1.0 RC1b

I am using the TreeTable and want only the nodes (not leaves) to be checkable. But apparently the value set by the method setCheckNodes(boolean) is not applied:


public void onModuleLoad() {
final Viewport viewport = new Viewport();
viewport.setLayout(new FillLayout());
final List<TreeTableColumn> columns = new ArrayList<TreeTableColumn>();
final TreeTableColumn column = new TreeTableColumn("Name", 150f);
columns.add(column);

final TreeTableColumnModel cm = new TreeTableColumnModel(columns);
final TreeTable treeTable = new TreeTable(cm);
treeTable.setSelectionMode(SelectionMode.MULTI);
treeTable.setCheckable(true);
treeTable.setCheckNodes(CheckNodes.PARENT);

final Object[] values = new Object[1];
values[0] = "23";
final TreeTableItem parent = new TreeTableItem(new Object[] { "" });
treeTable.getRootItem().add(parent);

final TreeTableItem child1 = new TreeTableItem(new Object[] { "" });
parent.add(child1);
final TreeTableItem child2 = new TreeTableItem(new Object[] { "" });
parent.add(child2);
viewport.add(treeTable);
RootPanel.get().add(viewport);
}
The reason for this behaviour lies in the class TreeItemUI#updateJointStyle (line318):


...
public void updateJointStyle() {
...
// !!!Checks the checkable, but this property was set in the TreeTable!!!
if (item.tree.getCheckable()) {
...
My proposal: forward the TreeTable#setCheckable to Tree#setCheckable:


public class TreeTable extends Tree implements BaseTable {
...
public void setCheckable(boolean checkable) {
super.setCheckable(checkable);
}
...
}

darrellmeyer
24 Jun 2008, 6:47 PM
Fixed in SVN.

flow
25 Jun 2008, 6:06 AM
Thanks, Darrell