First, we will check Paging Overview and Basic Examples about the paging in SMART datagrid.
All data which will be displayed in each page does not have to be loaded in the data set in advance. You can specify the expected total page number, and load and display the necessary data from the event before and after moving each page.
Grid Data Set basically supports virtual rows. In other words, when specify the row number by calling setRowCount, if do not specify the default value, it will prepare the room for the row number rather than to create actual data rows. After this, you can save the value of the data rows actually through updateRow, etc. You can check whether the data has been loaded in a specific row through hasData method.
If use rowCount, you can simply implement the way to load the necessary data when change the page. In order to implement it, you should specify the total page number first.
// Specify the number of the data rows.
dataset.setRowCount(53);
// 10 rows for the page size, total 6 pages.
grid.setPaging(true, 10, 6);
And, if the data which will be displayed has not been loaded when the page location is changed, it will get the data.
grid.onPageIndexChanged = function (grid, oldPage, newPage) {
var start = newPage * grid.pageSize();
if (!dataset.hasData(start)) {
loadData(start);
}
};
As the example above, you can increase the necessary pages during the change before specifying rowCount in advance.