iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
var grid = ISGetObject("WebGrid1");
window.alert(grid.TotalLoadedRows); // Doesn't change after record has been added at client side.
window.alert(grid.TotalRows);// Doesn't change after record has been added at client
window.alert(grid.RootTable.GetRowsCount());// Doesn't change after record has been added at client side
window.alert(grid.RootTable.Rows); // Is null.
window.alert(grid.RootTable.Rows.length); // Throws error.
How do I get the TOTAL number of rows in the grid?
Hello,Try to use the following code:function GetTotal() { var grid = ISGetObject("WebGrid1"); var getTotal = grid.TotalRows; var getChangesTotal = grid.RootTable.GetChangesCount(); alert(getTotal + getChangesTotal); }GetChangesCount() method is used to get the changes made in WebGrid. In this case, when you add new row, the total changes will be counted as well by using this method.Therefore, you will get the total rows along with the added rows.Hope this helps. Thank you.
Hello,
Try to use the following code:
function GetTotal() { var grid = ISGetObject("WebGrid1"); var getTotal = grid.TotalRows; var getChangesTotal = grid.RootTable.GetChangesCount(); alert(getTotal + getChangesTotal); }
GetChangesCount() method is used to get the changes made in WebGrid. In this case, when you add new row, the total changes will be counted as well by using this method.
Therefore, you will get the total rows along with the added rows.
Hope this helps.
Thank you.
This won't work either because the user can modify an existing row which would cause the count to be incremented by 1 too many (1 from the TotalRows and 1 from the GetChangesCount).
I made a quick method that seems to work:
function WebGrid_GetTotalRowCount(gridID) { try { var grid = WebGrid_GetGrid(gridID); if (grid == null || grid.RootTable == null) { return 0; } // NOTE: This is done because Intersoft doesn't return the TotalRows accurately for a WebGrid using BatchUpdate var rowCount = 0; while (true) { var row = grid.RootTable.GetRow(rowCount) if (row == null) { return rowCount; } rowCount++; } } catch (ex) { ShowJSException(ex); } }
var grid = ISGetObject("WebGrid1");var rowCount=grid.RootTable.GetRowsCount()//grid.TotalRowswindow.alert(rowCount);
Did you even bother reading my post?
Anyhow, this does not return the total number of rows in the grid.
I use TotalRows method in order to obtain the total grid's rows, and the method also gets the total rows after a record is added.
function GetTotal() { var grid = ISGetObject("WebGrid1"); alert(grid.TotalRows); }
I have created a sample for your reference.
Hope this helps. Thank you.
Regards,
-Martin-
Hello,I use TotalRows method in order to obtain the total grid's rows, and the method also gets the total rows after a record is added.function GetTotal() { var grid = ISGetObject("WebGrid1"); alert(grid.TotalRows); }I have created a sample for your reference.Hope this helps. Thank you. Regards,-Martin-
Please read my initial post.
Here's a screen shot to show you that it doesn't return the correct # of rows.
It is not designed for BatchUpdate scenario. It does not return the correct total because the added rows in your screenshot has not been saved in database yet.
Regards,Handy
Hello,It is not designed for BatchUpdate scenario. It does not return the correct total because the added rows in your screenshot has not been saved in database yet.Regards,Handy
So I assumed.
Do you have a workaround so I can get the correct # of rows that are visible in the grid?
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname