PDA

View Full Version : DWRProxy and PagingToolbar



gounis
27 Sep 2007, 6:06 AM
Hello,

I am using the DWRProxy of http://extjs.com/forum/showthread.php?t=5586&highlight=DWRProxy and it works fine. I want to add a paging toolbar to the grid's footer and I added the following code to the grid.js file:


var gridFoot = grid.getView().getFooterPanel(true);

// add a paging toolbar to the grid's footer
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 6,
displayInfo: true,
displayMsg: 'Displaying users {0} - {1} of {2}',
emptyMsg: "No topics to display",
});

First page is loaded using start:0 and limit:22 parameters and ['walter,true'] arguments


ds.load({params:{start:0, limit:6}, arg:['walter', true]})

When I try to load the second page, the java server-side throws an error : Missing method or missing parameter converters. I guess that when I use the toolbar, the parameters are passed to the server but not the arguments. How can I pass the arguments to the server using the toolbar?

devnull
27 Sep 2007, 6:15 AM
add your extra args as baseParams to the store itself, or insert them as params in its beforeload event if they need to be dynamic.

gounis
27 Sep 2007, 7:05 AM
Thanks for replying...

I use:



ds.baseParams = {
params:{start:0,limit:6},
arg:["ahahahaha"]
};
});

ds.load();


but it doesn't load anything

faro
7 Oct 2007, 8:18 AM
We have the same problem..are there any solutions?

gounis
17 Oct 2007, 2:21 AM
Change the load function of dwrproxt into


load : function(params, reader, callback, scope, arg) {
if(this.fireEvent("beforeload", this, params) !== false) {
var sort;
if(params.sort && params.dir) sort = params.sort + ' ' + params.dir;
else sort = '';
var delegate = this.loadResponse.createDelegate(this, [reader, callback, scope, arg], 1);
var callParams = new Array();

if(params.start != null && params.limit != null)
{
callParams.push(params.start);
callParams.push(params.limit);
}

if(params.arg) {
for(var p=0; p < params.arg.length; p++){
callParams.push(params.arg[p]);
}
}
/*
if(this.pagingAndSort) {
callParams.push(params.start);
callParams.push(params.limit);
//callParams.push(sort);
}
*/
callParams.push(delegate);
this.dwrCall.apply(this, callParams);
} else {
callback.call(scope || this, null, arg, false);
}
},

and then set the baseParams as


ds.baseParams = {
start:0,
limit:6,
arg:["ahahahaha"]
};
});