Even with the seamless access to large data that LiveScrolling provides, there are still circumstances where traditional Paging is appropriate. Sigma Grid supports paginal output.
In sample below number of rows per page set to 30 and number of pages set to 30.
-
Inline data page navigator.
- Use the paging buttons to page forward and back through the data.
- Notice that whenever a new page is loaded a request is made to the server.
Code
Declare pageCtl in context. pageCtl has following attributes.
- pageSize - Specify how many rows per page.
- callback - By calling which SigmGrid can get the page data.
var context = {
pageCtl:{
pageSize:20,
callback:turnPage
}
};
Implement the callback function, the return object should contain the following attributes.
-
total - Specify how many rows need to be displayed.
-
index - Index of current page. Based on zero.
-
elements - Data array to be displayed.
function turnPage(pageCtl){
var page = {};
page.index = pageCtl.page.index;
page.total = 600;
var elements = [];
for(var i=elements.length;i< pageCtl.pageSize;i++){
var rowData = {};
rowData.client="Somebody_"+page.index+"_"+i;
rowData.date_time = Date();
rowData.receiver= i%2==0?"Steven":"Tracy";
rowData.priority= i%2==0?"High":"Low";
rowData.issue = "Some Issues :" + page.index+"_"+i;
elements.push(rowData);
}
page.elements = elements;
return page;
}
Call Logging
Tips
Aggregate objects in context are needed to tell Sigma Grid how to calculate aggregates.
Each Aggregate object has three attributes.
col - To specify calculate aggregate on which column.
exp - To specify calculate which aggregate. Counld be sum,avg,max,min and count.
format - To specify what format the aggregate result is displayed in.
|