Select All childs checkbox in a TreeGrid

Hi
I am using a tree grid.
I need a checkbox in each record for selection. That can be done easily by using a boolean field ( since i need the tick markt to indicate the selections )

My requirement here is
If i select/unselct a parent all the records which are children to this parent must be selected/unselected and also this boolean field should be updated with the selection.
How to achieve this that is on the event of a parent field click all of its children field should be reflected.

Can you help me in this…

Hi Rajadurai,
There are various possible ways to achieve this. One approach would be to override ‘getCellValue()’ on the TreeGrid.
Your override would use the ‘colNum’ parameter to determine whether you were looking at this special boolean field. If so you’d want to call Tree APIs to get a list of the current record’s parents, and check whether their value for this field was true or false, and return the appropriate value based on this.

Note that for all other columns, this method would have to call
return this.Super(“getCellValue”, arguments);
to ensure the correct values showed up in the other cells.

Will this work for you?

I need a event handler

Hi,
It seems the solution( getCellValue ) wil work in the following manner.
During the initial loading of the tree grid record i can load some values for a specific field based on its parent record values.

What my exact need is like a event handler. If i change ( select/ unselect) the boolean field of the parent then all the boolean fields of its children should be updated with this value.
Can i use ‘cellChanged’ method of treegrid field to handle this. How can i get the children for this parent..and how to get the cotrol over the field of the chidren

Hi rajadurai,

Try searching the docs for “get children” or any similar phrase and you should find the relevant APIs.

Having obtained the child nodes, change the value of the property you check in your getCellValue() implementation, and ask the TreeGrid to redraw().