PDA

View Full Version : Paging toolbar next page doesn't work



rimbaudsolaris
6 Jul 2010, 6:47 AM
I've a grid with pagination toolbar of 10 records per page, but when I click on the next button the next ten record are not shown.

This is the json structure


{
'rows': 20,
'users': [
{
"id": 2526,
"sybilProfile": [],
"sybilRole": [
{
"id": 17,
"name": "Report",
"order": 16}, {
"id": 2,
"name": "Scanner",
"order": 4}, {
"id": 14,
"name": "Robin",
"order": 13}, {
"id": 9,
"name": "Replier",
"order": 7}, {
"id": 3,
"name": "Assigner",
"order": 3}, {
"id": 4,
"name": "Allocator",
"order": 9}, {
"id": 20,
"name": "Reset",
"order": 19}, {
"id": 5,
"name": "Preparer",
"order": 10}, {
"id": 7,
"name": "Coordinator",
"order": 8}, {
"id": 10,
"name": "Canceller",
"order": 5}, {
"id": 6,
"name": "Reviewer",
"order": 11}, {
"id": 8,
"name": "Controller",
"order": 6}, {
"id": 19,
"name": "Repat",
"order": 18}, {
"id": 12,
"name": "Reader",
"order": 12}],
"userAccessRight": "",
"userActive": true,
"userFirstName": "Marianne",
"userLastName": "DELVENNE",
"userNotificationFlag": "",
"userPassword": ""}, {
"id": 9832,
"sybilProfile": [],
"sybilRole": [
{
"id": 4,
"name": "Allocator",
"order": 9}, {
"id": 2,
"name": "Scanner",
"order": 4}, {
"id": 20,
"name": "Reset",
"order": 19}, {
"id": 10,
"name": "Canceller",
"order": 5}, {
"id": 7,
"name": "Coordinator",
"order": 8}, {
"id": 5,
"name": "Preparer",
"order": 10}, {
"id": 8,
"name": "Controller",
"order": 6}, {
"id": 6,
"name": "Reviewer",
"order": 11}, {
"id": 12,
"name": "Reader",
"order": 12}, {
"id": 9,
"name": "Replier",
"order": 7}, {
"id": 3,
"name": "Assigner",
"order": 3}],
"userAccessRight": "",
"userActive": true,
"userFirstName": "Christine",
"userLastName": "ACKERL",
"userNotificationFlag": "",
"userPassword": ""}, {
"id": 7520,
"sybilProfile": [
{
"id": 1,
"name": "User",
"sybilRole": [
{
"id": 4,
"name": "Allocator",
"order": 9}, {
"id": 5,
"name": "Preparer",
"order": 10}, {
"id": 6,
"name": "Reviewer",
"order": 11}, {
"id": 12,
"name": "Reader",
"order": 12}]}],
"sybilRole": [],
"userAccessRight": "",
"userActive": true,
"userFirstName": "Maria-Jesus",
"userLastName": "CASTILBLANQUEZ VAQUERIZO",
"userNotificationFlag": true,
"userPassword": ""}, {
"id": 23240,
"sybilProfile": [],
"sybilRole": [],
"userAccessRight": "",
"userActive": true,
"userFirstName": "Margarita",
"userLastName": "ALVAREZ ALVAREZ",
"userNotificationFlag": true,
"userPassword": ""}, {
"id": 25474,
"sybilProfile": [],
"sybilRole": [
{
"id": 2,
"name": "Scanner",
"order": 4}, {
"id": 9,
"name": "Replier",
"order": 7}, {
"id": 3,
"name": "Assigner",
"order": 3}, {
"id": 4,
"name": "Allocator",
"order": 9}, {
"id": 5,
"name": "Preparer",
"order": 10}, {
"id": 7,
"name": "Coordinator",
"order": 8}, {
"id": 10,
"name": "Canceller",
"order": 5}, {
"id": 16,
"name": "Supervisor",
"order": 15}, {
"id": 20,
"name": "Reset",
"order": 19}, {
"id": 6,
"name": "Reviewer",
"order": 11}, {
"id": 8,
"name": "Controller",
"order": 6}, {
"id": 19,
"name": "Repat",
"order": 18}, {
"id": 12,
"name": "Reader",
"order": 12}],
"userAccessRight": "",
"userActive": true,
"userFirstName": "Maria Pilar",
"userLastName": "THOMAS RIBES",
"userNotificationFlag": "",
"userPassword": ""}, {
"id": 24000,
"sybilProfile": [
{
"id": 1,
"name": "User",
"sybilRole": [
{
"id": 4,
"name": "Allocator",
"order": 9}, {
"id": 5,
"name": "Preparer",
"order": 10}, {
"id": 6,
"name": "Reviewer",
"order": 11}, {
"id": 12,
"name": "Reader",
"order": 12}]}],
"sybilRole": [],
"userAccessRight": "",
"userActive": true,
"userFirstName": "Gabriele",
"userLastName": "KREMER",
"userNotificationFlag": "",
"userPassword": ""}, {
"id": 25582,
"sybilProfile": [
{
"id": 1,
"name": "User",
"sybilRole": [
{
"id": 4,
"name": "Allocator",
"order": 9}, {
"id": 5,
"name": "Preparer",
"order": 10}, {
"id": 6,
"name": "Reviewer",
"order": 11}, {
"id": 12,
"name": "Reader",
"order": 12}]}],
"sybilRole": [],
"userAccessRight": "",
"userActive": true,
"userFirstName": "Hilde",
"userLastName": "BUGGENHOUDT",
"userNotificationFlag": true,
"userPassword": ""}, {
"id": 19203,
"sybilProfile": [],
"sybilRole": [
{
"id": 17,
"name": "Report",
"order": 16}, {
"id": 2,
"name": "Scanner",
"order": 4}, {
"id": 9,
"name": "Replier",
"order": 7}, {
"id": 3,
"name": "Assigner",
"order": 3}, {
"id": 4,
"name": "Allocator",
"order": 9}, {
"id": 20,
"name": "Reset",
"order": 19}, {
"id": 5,
"name": "Preparer",
"order": 10}, {
"id": 7,
"name": "Coordinator",
"order": 8}, {
"id": 10,
"name": "Canceller",
"order": 5}, {
"id": 13,
"name": "ServiceAdministrator",
"order": 1}, {
"id": 6,
"name": "Reviewer",
"order": 11}, {
"id": 8,
"name": "Controller",
"order": 6}, {
"id": 19,
"name": "Repat",
"order": 18}, {
"id": 12,
"name": "Reader",
"order": 12}],
"userAccessRight": "",
"userActive": true,
"userFirstName": "Antoinette",
"userLastName": "WIGBOLD",
"userNotificationFlag": "",
"userPassword": ""}, {
"id": 21365,
"sybilProfile": [],
"sybilRole": [
{
"id": 4,
"name": "Allocator",
"order": 9}, {
"id": 2,
"name": "Scanner",
"order": 4}, {
"id": 20,
"name": "Reset",
"order": 19}, {
"id": 10,
"name": "Canceller",
"order": 5}, {
"id": 7,
"name": "Coordinator",
"order": 8}, {
"id": 5,
"name": "Preparer",
"order": 10}, {
"id": 8,
"name": "Controller",
"order": 6}, {
"id": 6,
"name": "Reviewer",
"order": 11}, {
"id": 19,
"name": "Repat",
"order": 18}, {
"id": 12,
"name": "Reader",
"order": 12}, {
"id": 9,
"name": "Replier",
"order": 7}, {
"id": 3,
"name": "Assigner",
"order": 3}],
"userAccessRight": "",
"userActive": true,
"userFirstName": "FRANCESCA",
"userLastName": "BRASIELLO",
"userNotificationFlag": "",
"userPassword": ""}]
}This is the store defined on the jsp


var usersListStore = new Ext.data.Store({
url: '<c:url value="/comref/jsonSybilUsers.do"/>',


reader: new Ext.data.JsonReader({
root: 'users',
id: 'id',
totalProperty: 'rows'


}, [
{name: 'id', mapping: 'id'},
{name: 'userFirstName', mapping: 'userFirstName'},
{name: 'userLastName', mapping: 'userLastName'},
{name: 'userNotificationFlag', mapping: 'userNotificationFlag'}
]

),
remoteSort: true

}
});
This is the grid defined on the jsp


usersList = new Ext.grid.EditorGridPanel({
id: 'usersList',
title: '<fmt:message key="sybiladmin.comRefSync.usersListLabel"/>',
height: 350,
el: 'users-list',
// specify the check column plugin on the grid so the plugin is initialized
plugins: checkColumn,
totalProperty: 'rows',
store: usersListStore,
cm: cm,

bbar: new Ext.PagingToolbar({
pageSize: 10,
store: usersListStore,
totalProperty: 'rows',
displayInfo: true,
displayMsg: 'total {2} results found. Current shows {0} - {1}',
emptyMsg: '<fmt:message key="sybiladmin.sybilUser.noUser"/>'

})

}
});

usersList.getStore().load({params:{start:0, limit:10}});




this is method which is called and return the json data based on the start and limit param



private String getXMLData(String nodeString, String startString,
String limitString) {
Long nodeId = null;
int start;
int limit;

try {
nodeId = Long.parseLong(nodeString);
start = Integer.parseInt(startString);
limit = Integer.parseInt(limitString);
} catch (NumberFormatException nfe) {
return "";
}

List<SybilUser> sybilUsers = sybilUserService.getAllSybilUsers(nodeId);
JsonConfig jsonConfig = new JsonConfig();
StringBuilder builder = new StringBuilder();

builder.append("{'rows': " + sybilUsers.size() + ", ");
builder.append("'users': [");
int size = sybilUsers.size() - start;
for (int i = start; i < sybilUsers.size() && limit > 1; i++, limit--)
{

jsonConfig.setExcludes(new String[] { "serviceId" });
JSON json = JSONSerializer.toJSON(sybilUsers.get(i),
jsonConfig);
builder.append(json.toString());
if (i < size && limit > 2) {
builder.append(", ");
}
}

builder.append("]}");

LOGGER.info(builder.toString().replaceAll("\"Y\"", "true"));
return builder.toString();
}
When I click on the next page button of the toolbar the getXMLData method is executed with the right param start and limit, but the grid doesn't show the next 10 records.


Thanks for your help