PDA

View Full Version : [FIXED] TreePanel - CheckNodes



fother
15 Jul 2009, 9:13 AM
tested in hosted mode win vista

how to reproduce:
1- double click in "Beethoven"
2 - double click in "Quartets"
3 - click in "Six String Quartets"

issue:
will checked "Six String Quartets", and "Quarttes" and "Beethoven".. but only the leaf can be checked

code example


Folder model = TestData.getTreeModel();

TreeStore<ModelData> store = new TreeStore<ModelData>();
store.add(model.getChildren(), true);

final TreePanel<ModelData> tree = new TreePanel<ModelData>(store);
tree.setDisplayProperty("name");
tree.setCheckable(true);
tree.setAutoLoad(true);
tree.setCheckNodes(CheckNodes.LEAF);

RootPanel.get().add(tree);

sven
15 Jul 2009, 9:18 AM
Moved to bug forum.

fother
15 Jul 2009, 9:19 AM
ok

fother
27 Jul 2009, 6:19 AM
in gxt 2.0.1 appears fixed..
I will provide more test case..

but.. for this time.. mark as FIXED

sven
27 Jul 2009, 6:21 AM
Yes issue was fixed but thread was not updated. Doing this now.

fother
27 Jul 2009, 7:20 AM
this bug its parcial corret..

how to reproduce..
click in the button add.. you will see that always the root item will appears with checkbox(I create various other testcase and always return the same situation)

other ways.. isnt possible select the root item

code example


public void onModuleLoad() {

final TreeStore<ModelData> store = new TreeStore<ModelData>();

final TreePanel<ModelData> tree = new TreePanel<ModelData>(store);
tree.setDisplayProperty("name");
tree.setCheckable(true);
tree.setAutoLoad(true);
tree.setCheckNodes(CheckNodes.LEAF);

Button btn = new Button("add", new SelectionListener<ButtonEvent>() {

@Override
public void componentSelected(ButtonEvent ce) {

Folder[] folders = new Folder[] { new Folder("Beethoven", new Folder[] {

new Folder("Quartets", new Music[] { new Music("Six String Quartets", "Beethoven", "Quartets"),
new Music("Three String Quartets", "Beethoven", "Quartets"),
new Music("Grosse Fugue for String Quartets", "Beethoven", "Quartets") }) }) };

Folder root = new Folder("root");
for (Folder folder : folders) {
root.add(folder);
}

store.add(root, true);
}
});

RootPanel.get().add(btn);
RootPanel.get().add(tree);

}

sven
27 Jul 2009, 7:25 AM
This is more an issue in your code. Step through it was a debugger and you will it. the root gets marked as a leaf.

sven
27 Jul 2009, 7:44 AM
Commited a little change for this to SVN to make this easier.

fother
27 Jul 2009, 7:51 AM
in the next release the code that I post will work fine?

sven
27 Jul 2009, 8:08 AM
Yes, also updated the Checkable Treepanel example to show this.

fother
27 Jul 2009, 8:18 AM
great..

other way.. dont have nothing to see with the bug.. but its one suggest..

why dont create the new check style that when the all children its deschecked (dont checked.. I dont know how write this..) the parent deschecked too..

like this http://www.blueshoes.org/_bsJavascript/components/tree/examples/example3.html

I'm implement this.. but I think that would be implement by default.. :)