PDA

View Full Version : How to Add checkbox into TreeGrid?



tomasi
20 Jul 2009, 9:17 PM
There is only one example about checkbox with TreePanel. But how could I put checkbox into TreeGrid? I looked at the example of treePanel. We can use tree.setCheckable(true) but not in the TreeGrid. So I tried another way. I used tree.addPlugin() to add CheckBoxSelectionModel(). It works fine, but on the top of checkbox (select all) function doesn't work? Is it a bug? Or should I try any way?:s

uozturk
25 Jul 2009, 10:28 PM
looking for the same.

any solution?

Arno.Nyhm
5 Aug 2009, 8:21 AM
you have a working example code?

mtarantini
11 Aug 2009, 6:13 AM
+1

I'm looking for the same kind of widget. A TreeGrid with chebox and the possibility to select the Cascade Behavior and the CheckNode Behavior and with the 2 methods "Expand All" & "Collapse All" which doesn't exist for the TreeGrid.

I'have notice that the checkbox in the column model doesn't work as well when using the addPlugin() method and the CheckBoxSelectionModel

tomasi
11 Aug 2009, 5:47 PM
Problem solved! I used gwt 1.7 gxt 2.01 then Used TreeGrid example code that add checkBox into treeGrid by using addPlugin.Then it works. the followings are my peice of code and the result.


CheckBoxSelectionModel<ModelData> sm = new CheckBoxSelectionModel<ModelData>();
Folder model = getTreeModel();

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

ColumnConfig name = new ColumnConfig("name", "Name", 100);
name.setRenderer(new TreeGridCellRenderer<ModelData>());
ColumnConfig date = new ColumnConfig("author", "Author", 100);
ColumnConfig size = new ColumnConfig("genre", "Genre", 100);
ColumnModel cm = new ColumnModel(Arrays.asList(sm.getColumn(),name, date, size));
TreeGrid<ModelData> tree = new TreeGrid<ModelData>(store, cm);
tree.setBorders(true);
tree.setSize(400, 400);
tree.setAutoExpandColumn("name");
tree.setTrackMouseOver(false);
tree.setSelectionModel(sm);
tree.addPlugin(sm);

mtarantini
11 Aug 2009, 11:03 PM
It's a temporary workaround,

You will not have the fonctionnalities of the TreePanel with setCheckable(true), like the CheckNode Behavior or the Cascade Behavior are the collapseall / expandall except if you implements all those fonctionnalities (which I hope GXT Team will look forward for giving us such a widget).

But it's the solution is enough for your needs, then good for you :D

tomasi
12 Aug 2009, 12:16 AM
It's a temporary workaround,

You will not have the fonctionnalities of the TreePanel with setCheckable(true), like the CheckNode Behavior or the Cascade Behavior are the collapseall / expandall except if you implements all those fonctionnalities (which I hope GXT Team will look forward for giving us such a widget).

But it's the solution is enough for your needs, then good for you :D

yes you're right. That's all I want for now! I also hope Gxt Team can make it better!

adelio.corso
17 Feb 2010, 2:24 PM
Hi guys,

Can someone re-post this request into Gxt Feature Requests Forum - I've just registered and don't have permissions to create new threads yet.

Would be nice to have a TreeGrid with setCheckable option enabled, like the TreePanel does.

Thanks,
Adelio

gaozhi
6 Jun 2010, 11:29 PM
why not treeGrid don't the same as treepanel add checked : false in it's store

sven
7 Jun 2010, 6:25 AM
why not treeGrid don't the same as treepanel add checked : false in it's store

GXT3 will have three state checkbox support in TreePanel and TreeGrid