:: Forum >>

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
Friday, July 31, 2009
Hi Raj,

I'm after the same thing - did you find any answers yet?
Steve
Sunday, August 9, 2009
If you are referring to client side paging, then Alex did post a solution based on "RowwOffset" here:
/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); //real rows

var totalrows = obj.getRowCount();
obj.setRowCount(6); //paged rows

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:
/javascript.forum.15805.5/blank-page-during-paging.html
and here:
/javascript.forum.21532.1/loading-message-inside-scrolltemplate.html
HTH
Carlos
Monday, August 10, 2009

This topic is archived.


Back to support forum

Forum search