Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Vikram Jagannathan on Aug 17, 2009 14:30
open dhtmlx forum
TreeGrid Filter haschildren for parent row returns 0

Hi,

When a treegrid is filtered, the invocation of hasChildren() on a parent row (actually has child node), which is not rendered in the filtered list, returns 0.

Grid/Treegrid version: dhtmlxSuite_2008Rel3_pro_81009

Steps to recreate:

Sample File: ...\dhtmlxSuite_2008Rel3_pro_81009\dhtmlxTreeGrid\samples\grid_operations\treegrid_filtering.html

1. Invoke mygrid.hasChildren("2");
This would return a value 5.

2. Select "10 weeks in top 100" in the "Select Filter" column.
This would NOT render the "Music" node and its 5 Children Nodes.

3. Now, again invoke mygrid.hasChildren("2");
This would now return a value of 0. It should actually return 5.

Can you please provide a fix for this issue?

Thanks.
Answer posted by dhxSupport on Aug 18, 2009 00:58
>>Can you please provide a fix for this issue?
This is expected behaviour because of hasChildren() method retruns number of NOT FILTERED childred. If you select "5 weeks in top 100", hasChildre("2") will return 2, if you select "9 weeks in top 100" methos will return 1. If no rows is visible, hasChildren() returns 0.
Answer posted by Vikram Jagannathan on Aug 18, 2009 06:27
>> This is expected behaviour because of hasChildren() method retruns number of NOT FILTERED childred... If no rows is visible, hasChildren() returns 0.

In this case, can you please provide me a patch/work around so as to return the number of children correctly even when the row is invisible?

Grid/Treegrid version: dhtmlxSuite_2008Rel3_pro_81009

Thanks.
Answer posted by Support on Aug 18, 2009 09:01
You can use


var h2 = grid._f_rowsBuffer || grid._h2;
var count = h2.get[rowID].childs.length;

where 
   grid - grid object
   rowID - id of the row in question
Answer posted by Vikram Jagannathan on Aug 18, 2009 09:06

Works like a charm!!

Thanks.