PDA

View Full Version : Checkbox TreeGrid



dhphuoc
4 Feb 2011, 7:22 AM
If you have a need to use a checkbox TreeGrid that works similarly as the TreePanel, and can't wait for the GXT v3.0, you may want to consider the attached custom TreeGrid. I am not aware of any issues with it at this time. You would use the CheckboxTreeGrid as you normally would with a TreeGrid, with the following difference configuration for the first column that contains the check boxes.


ColumnConfig name = new ColumnConfig("name", "Name", 300);
name.setRenderer(new CheckboxTreeGridCellRenderer<ModelData>(true));

Thanks,
Phil

jonas sabu
15 Feb 2011, 7:43 AM
Hey,

I used your CheckBoxTreeGrid and it compiles and runs without errors.
The problem is that it doesn't show any checkboxes...

I do :

ColumnConfig name = new ColumnConfig("name", "Name", 100);
name.setRenderer(new CheckboxTreeGridCellRenderer<ModelData>());
ColumnModel cm = new ColumnModel(columns);

CheckboxTreeGrid<ModelData> tree = new CheckboxTreeGrid<ModelData>(store, cm);

Do i have to do anything else to show the checkboxes? Like in TreePanel we do .setCheckable(true) or something..

dhphuoc
15 Feb 2011, 10:26 AM
Yes, you need to pass "true" to the renderer constructor:
name.setRenderer(new CheckboxTreeGridCellRenderer<ModelData>(true));

Phil

jonas sabu
15 Feb 2011, 11:42 AM
Thanks alot, that was the problem.
You know if is it possible to add a checkbox to the grid's columns to select all the elements?

dhphuoc
15 Feb 2011, 1:32 PM
Right now the checkbox tree grid follows the same cascade behaviors in a TreePanel, i.e. if you check a root node, all child nodes will be checked. So you may consider this feature as you build your tree store. Other than that, I don't know if what you are looking to do is possible or if it should be done that way. Good luck.

Phil

denu
18 Oct 2011, 11:04 PM
Great work with the Checkboxes! Is there a way to set any other column renderer to return Widget?

greetz

denu
26 Oct 2011, 11:15 PM
I've dealt with widget issue, but now I've encountered another problem.
How can I set some of the checkboxes initially checked? Is it store-dependent or should I check them manually after render?

dhphuoc
27 Oct 2011, 5:45 AM
Hi Denu, I think you probably need to set them after they are rendered. This custom treegrid was quickly put together when GXT 3.0 was not available, so the features/issues like those you reported were not thought through. Now you may want to consider 3.0 instead.

Best regards,
Phil

denu
27 Oct 2011, 11:12 PM
I'm using your CheckboxTreeGrid because our development team don't want to use unstable version of GXT 3.0.
I've dealt with custom widgets in grid (by cloning GridCellRenderer changed to work with CheckboxTreeGrid) as well as setting initial checked checkboxes - with

be.getTreeGrid().expandAll();
be.getTreeGrid().setCheckedSelection(checkedItems);
be.getTreeGrid().collapseAll();

For anyone else having the same issues:
It must have been done in Events.ViewReady event, because nodes in root weren't rendered before. Then expandAll() was used to render all tree children (lazy init can be sometimes a "pain in the class").

thanks for your time & reply! :)
greetz

denu

denu
2 Jan 2012, 2:59 PM
Hi again ;)

Could you give me some tip with creating a three state checkboxes within this extension?

joshi.shrikant
1 Feb 2012, 2:15 AM
Is i possible to disable parent checkboxs like we can do with TreePanel ?
treePanel.setCheckNodes(CheckNodes.LEAF);

Mathew567
24 Sep 2013, 2:50 PM
Do we have this CheckBoxTreegrid functionality in GXT 3.0, I am unable to locate a checkBoxTreeGrid component in 3.0 .3.0 checkboxgrid is not a treegrid. we need checkboxtreegird with sorting/menu functionality also. Since 3.0 do not support ModelData, We want to upgrade this component. Any help/hint is greatly appreciated.


Thanks,
Mathew