Categories | Question details Back To List | ||
getRowsNum() is showing zero if the statement after the mygrid.load() Hi, I am showing the records from MS SQL. Its successfully retrieve the records. Now I need to show the total records in the Grid at the top of the Grid. So I used mygrid.getRowsNum() function below the mygrid.load("testpage.aspx"). But it is showing 0. I tried the same mygrid.getRowsNum() in a separate function. It showing correct row count. But I wonder that if i write a alert() statement before the getRowsNum() function then its showing right row count.ie. mygrid.load("testpage.aspx"); alert('xxx'); document.getElementById("totalcount").innerHTML = mygrid.getRowsNum(); If alert() is not there then the getRowsNum() returns zero count. What is actually happen here? Pl explain and give me the solution. Ganesh. Answer posted by Support on May 30, 2008 05:39 The xml loading is async. process http://www.dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Common_Problems_in_Grid.html#grid_art_comprob mygrid.load(url,function(){ alert(grid.getRowsNum()); }); Answer posted by Ganesh on May 30, 2008 06:41 Thanks for your response. alert(mygrid.getRowsNum()) is ok. But I need to show the totalrecords in a label. How to do that? Tell me any other way. Thanks i advance. Ganesh. Answer posted by Support on May 30, 2008 09:25 You can use any kind of operation, the code called from such onload handler will work correctly. mygrid.load(url,function(){ document.getElementById("totalcount").innerHTML = mygrid.getRowsNum(); }); Answer posted by Ganesh on May 30, 2008 22:04 Thank you very much. Now I got the Total records. It would be better to have another small feature like " Loading... " in the Grid. That is, my external page takes few seconds to load the records in the Grid. Can I have a text like Loading... in the region of the Grid.? Because as of now its showing empty area. I tried like this, < div id="gridbox" style="background-color: white; height: 550px"> Loading... </div>I thought that, the Loading... text will appear until the grid get records from external file. But unfortunetly, after loaded the records the Loading.. text still visible. Please tell me how can I do this small task. Regards, Answer posted by Support on Jun 02, 2008 02:20 grid provides onXLE and onXLS events for such task Please check http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=search&q=948&ssr=yes&s=onXLS http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=search&q=2137&ssr=yes&s=onXLS |