Categories | Question details Back To List | ||
Under what circumstances would a call to grid.getRowsNum() return 0? The grid in question is populated via loadXML().
grid.getColumnCount() returns the correct NON-zero value.
All cells seem to exist and are filled corectly. Answer posted on May 05, 2007 14:10 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. Answer posted by Jonny on May 08, 2007 14:44 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! Answer posted on May 08, 2007 18:37 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. Answer posted by Jonny on May 10, 2007 04:30 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. Answer posted on May 10, 2007 10:57 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 Answer posted by Inga (Support) on Dec 04, 2014 20:02 The information connected with spreadsheet web and apps for touch also can help you, so please check it too. |