Categories | Question details Back To List | ||
looping through a grid with filters hi, we have a treegrid with 1 column which has a filter box we are trying to loop through the grid to get all items. however we are finding that if we add criteria into the filter box, it only loops through the visible rows. we want it to loop through all rows not just the visible ones this is the loop code we are using: grid._h2.forEachChild(0, function(row) { id = row.id; rowArray[rowArray.length] = id; }); thanks Answer posted by Support on Jun 03, 2009 05:15 If you not using smart-rendering or smart-xml-parsing modes, you can try to use mygrid.forEachRow(code); It will loop from all rows in treegrid. There is no stable way to loop through all rows in filtered treegrid , the next code will work for latest TreeGrid, but it based on inner vars, so there can be problem in future updates var h = grid._f_rowsBuffer||grid._h2; //takes saved hierarchy or actual one h.forEachChild(0, function(row) { id = row.id; rowArray[rowArray.length] = id; }); Answer posted on Jun 03, 2009 05:27 yes we are using smart xml parsing. so is there no stable way in that case? Answer posted by Support on Jun 03, 2009 05:45 >>yes we are using smart xml parsing. The second solution, in above post, will work for such init, but it is based on inner variables - so it may be changed in next versions. Answer posted on Jun 03, 2009 05:54 but as you said this is not stable and therefore we would not like to have to change code in a future version, as if we forget this could temporarily cause many problems for our customers. we will have to come up with our own work around. can your company come up with a function to handle this in a stable way? Answer posted by Support on Jun 03, 2009 07:59 You can use code as var hierarchy; grid.load(url,function(){ hierarchy = grid._h2; }); and use hierarchy to iterate through rows hierarchy.forEachChild(0, with above code snippet hierarchy will be saved just after data loading and will contain data about all rows in unfiltered grid structure Answer posted on Jun 03, 2009 08:19 thanks very much, and is this stable through future versions? Answer posted by Support on Jun 03, 2009 09:12 Yes, it uses only public properties - so this functionality will not be affected by future updates Answer posted on Jun 16, 2009 04:25 hi we have just noticed a problem with this is that if we want to loop through the grid after items have been dragged to it, then it is not looping through the newly added rows do you have any fix for this? thanks Answer posted on Jul 07, 2009 06:30 no? Answer posted by Support on Jul 08, 2009 01:19 Which version of grid you are using? Issue can't be reconstructed for grid 2.1 ( there was similar issue in older versions of grid ) |