Under what circumstances would a call to grid.getRowsNum() r

There are two possible ways

a) The call occured in moment when data not loaded yet.

The loadXML command is async, so the next command called after it can be
executed before XML really loaded and parsed in grid. To be sure that
XML already loaded you can use onLoadingEnd event or second parameter of
loadXML command.

grid.loadXML(someURL,function(){
//called after XML loaded
alert(grid.getRowsNum());
});

b) In case of paging or smartRendering, if page returns xml with “total_coun” attribute equal to 0 , the getRowsNum will also returns 0 value.


In the case of a) the “afterCall” method is being used.



For b) paging and smart rendering are not being used.



any other suggestions?



Thanks!

The only way when grid returns 0 from getRowsNum is such situation - it if really there are no rows rendered in grid.
If problem stable reconstructable for you - please provide any kind of sample where it can be reconstructed, because I’m not able to reconstruct such behaviour locally.


I believe I have found a solution.  The problem seems to be that ‘afterCall’ is call after the XML has been retrieved from the server but before it has been placed in the grid object.  My (temporary?) solution is to ‘afterCall’ a method that delay processing for 2 seconds then call the method that processes the data in the grid.  This solution completely eliminated the problem but is not a very clean solution.



I believe loadXML should not ‘afterCall’ until the grid object data load is complete.



Thanks for your help.

the after call method executed only after XML fully processed, so it must work correctly please be sure that you use correct syntax
    mygrid.setOnLoadingEnd(doAfterLoad);
not the
    mygrid.setOnLoadingEnd(doAfterLoad());

In second case the function called immideatly, not after XML loading

Also there is one more situation when command can fail - enableDistributedParsing - if distributed parsing enabled, afterCall will be executed after first chunk of xml parsed, not after all XML parsed