dhtmlxgrid - getRowsNum() in dynamic loading

Hi,



How can I get the total number of record not only the one that are visible? I’m using smart rendering and dynamic load.



Thanks.


If you will execute mygrid.getRowsNum() method after first portion of rows was loaded it will return total number of records:


mygrid.loadXML(“dynload.php”,function(){
alert(mygrid.getRowsNum());
});



thanks, it works but if I do the code below it returning me 0:



mygrid.loadXML(“dynload.php”);



alert(mygrid.getRowsNum());



I need to put the number of row in a variable… It does not work if I do



mygrid.loadXML(“dynload.php”);



var nNumberOfRow = 0;



nNumberOfRow=mygrid.getRowsNum();



alert(nNumberOfRow);   -> return 0



Do you have any idea?


This code returns 0 because of by the time of executing alert(mygrid.getRowsNum()); any row was loaded to the grid. The only way to detect when first portion of rows was loaded is to use 2nd paramether of loadXML method.


Ok, so I can not use it outside the function loadXML in 2nd parameters? Because this code below does not work too:



var intNumberOfRow = 0;



mygrid.loadXML(“dynload.php”,function(){
  intNumberOfRow = mygrid.getRowsNum();
 });



alert(intNumberOfRow); -> return 0


Finnaly I found a solution. I have put a timeout.