Categories | Question details Back To List | ||
rowcount in grid Hi is there a way to put a row count somewhere in the grid, possibly in a footer, and for it to always count the number of visible rows - e.g. if there are filter boxes at the top of the grid and the users enters text to filter out rows, it updates the row counter minus the rows that have been filtered out thanks Answer posted by dhxSupport on Feb 16, 2009 08:50 To recalculate footer's values you can use "onGridReconstructed" event (availible at PRO version only). To count rows num use getRowsNum() method: mygrid.attachFooter("Total rows:,#cspan,#cspan,#cspan,#cspan,<div id='total'>0</div>",["text-align:left;"]) ... mygrid.attachEvent("onGridReconstructed",calculateFooter); ... mygrid.loadXML("grid_numbers.xml",calculateFooter); ... function calculateFooter(){ Answer posted on Feb 16, 2009 15:17 thanks, that works fine however, if i have the first column type = "tree", and use the smartrendering then it does not count the rows of the tree items that are not open is there a way i can get it to count these as well thanks Answer posted by dhxSupport on Feb 17, 2009 08:06 To count row which are not open you can use following code: var s=0; s++ }); It will return all rows in grid (including parent and child rows). Answer posted on Mar 02, 2009 07:33 what if i wanted to get all visible parent and child rows as you stated, but in the grid i also have a filter and want it to show only the visible rows. the example 2 examples shown either provide me with all visible rows but not of sub children if they folders are not open... or of all rows regardless of the filter thanks Answer posted on Mar 02, 2009 08:52 in addition to the question asked above, we have also noticed that the row count is getting counted when a folder is opened but not when it is being closed. for example when we use expandall function it sets the row count fine buit then when we use collapseall function it is not recalcuating the row count thanks Answer posted by Support on Mar 03, 2009 06:14 >>but in the grid i also have a filter and want it to show only the visible rows With filter enabled the mygrid.getRowsNum(); - returns count of all visible rows, which exist in grid after filtering mygrid.getAllSubItems(0).split(",").length; - count of all rows, including ones in closed branches. By the way, there is a built in counter - http://dhtmlx.com/docs/products/dhtmlxTreeGrid/samples/grid_operations/treegrid_aggregation.html?un=1236090351000 >>buit then when we use collapseall function We will check the reason of the problem , as fast solution you can use grid.collapseAll(); grid.callEvent("onGridReconstructed",[]); //fire event manually Answer posted on Mar 07, 2009 12:27 thanks for your reply, i wish we would have been provided with the link at the start of this question... as my original question was asking if there is anything built in and i was provided with a manual way instead. i will now use the built in function. thanks for letting me know |