Grid Pagination...
How do we implement pagination with the Grid ? Is this feature available with the new release ? I found some topics in the forum but none talking about the implementation?
I want to display 10 results at a time. If anyone has some documentation or some examples that would help.
Thanks
Raj
July 31,
Hi Raj,
I'm after the same thing - did you find any answers yet?
Steve
August 9,
If you are referring to client side paging, then Alex did post a solution based on "RowwOffset" here:
http://www.activewidgets.com/javascript.forum.12092.28/paging-with-version-2-0.html
Where you can also find a solution for overwrite table.response method
(in case using a data model different than array).
The issue with last (incomplete) page could be solved this way:
<script>
var obj = new AW.UI.Grid;
obj.setCellData(function(col, row){return col + "." + row});
obj.setHeaderText("header");
obj.setColumnCount(4);
obj.setRowCount(15);
var totalrows = obj.getRowCount();
obj.setRowCount(6);
var pagerows = obj.getRowCount();
obj.setRowOffset(0);
document.write(obj);
document.write("<br>");
var buttonBack = new AW.UI.Button;
buttonBack.setControlText("Prev");
document.write(buttonBack);
buttonBack.onControlClicked = function(){
var x = obj.getRowOffset();
(x - pagerows ) > -1 ? obj.setRowOffset(x-pagerows) : alert('first page') ;
if ( obj.getRowCount() < pagerows ){
obj.setRowCount( pagerows );
}
obj.refresh();
}
var button = new AW.UI.Button;
button.setControlText("Next");
document.write(button);
button.onControlClicked = function(){
var x = obj.getRowOffset();
(x + pagerows ) < totalrows ? obj.setRowOffset(x+pagerows) : alert('last page') ;
var z = obj.getRowOffset();
if ( (z + pagerows ) > totalrows ){
obj.setRowCount(totalrows-z );
}
obj.refresh();
}
</script>
And you can find a paging-sorting-patch here:
http://www.activewidgets.com/javascript.forum.15805.5/blank-page-during-paging.html
and here:
http://www.activewidgets.com/javascript.forum.21532.1/loading-message-inside-scrolltemplate.html
HTH
Carlos
August 10,