PDA

View Full Version : Ext.Direct and Grid Paging, no parameters passed.



gianpaulo
13 Nov 2009, 11:13 PM
I tried the solution on this thread http://www.extjs.com/forum/showthread.php?t=71908&highlight=grid+paging but still no luck.

The PagingToolbar correctly displays the number of pages and records but when I clicked on next page, I saw on Firebug that no paging parameters are being passed. Why is that?

I'm using paramsAsHash: false, so I added the paramOrder property to the store's config. But now the grid won't get populated.

Here's my code:


HRIS.TimekeepingGrid = Ext.extend(Ext.grid.GridPanel,{
initComponent:function(){
otstore = new Ext.data.DirectStore({
directFn: HRIS.Overtime.index,
root:'data',
paramsAsHash: false,
fields:[
'id','reference_no','time_start'
],
idProperty:'id',
totalProperty:'total',
sortInfo:{
field:'id',
direction:'ASC'
},
paramNames:{
start:'start',
limit:'limit',
sort:'sort',
dir:'dir'
},
paramOrder:'start|limit|sort|dir'

});
Ext.apply(this,{
width:500,
height:300,
store:otstore,
bbar:new Ext.PagingToolbar({
pageSize:25,
store:otstore,
displayInfo:true

}),
cm:new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),

{dataIndex:'id',header:'ID'},
{dataIndex:'reference_no',header:'Reference No.'},
{dataIndex:'time_start',header:'Time Start'}
])
});

HRIS.TimekeepingGrid.superclass.initComponent.apply(this,arguments);
this.getStore().load({
params: {
start: 0,
limit: 10
}
});

I also tried using the PagingDirectStore but I can't get the grid populated.

A little help would be appreciated.

gianpaulo
15 Nov 2009, 11:26 PM
I really hoped someone could help me. I upgraded to 3.0.3 and the grid is being populated even without the paramsAsHash:false option. But still, the paging parameters (start&limit) are not being passed.

Could someone from the ExtJS team answer if Grid Paging using Ext.Direct is not possible so I can just use the traditional Store.

gianpaulo
18 Nov 2009, 5:20 AM
Wow. A lot of views but still no answer. I'm I really the only one having this issue? Can anyone show me a working Ext.Direct w/ GridPanel + Paging? :D

Condor
18 Nov 2009, 5:54 AM
Is the directFn in your API configured to have len:4?

ps. PagingDirectStore would do local paging, so it doesn't send start and limit parameters and expects all records in response.

gianpaulo
18 Nov 2009, 6:46 PM
Is the directFn in your API configured to have len:4?

ps. PagingDirectStore would do local paging, so it doesn't send start and limit parameters and expects all records in response.

Wow. Why haven't I thought of that? Works now. Thanks Condor!

I think this should be included in the docs. That paging parameters should be included defined in the server side method.

vadimv
28 Feb 2012, 11:57 PM
what format should have the data sent by server for a grid with paging toolbar? is this one ok ? :



{
"type": "rpc",
"tid": 2,
"action": "DirectReport",
"method": "GetReports",
"result": {
"total": 1,
"data": [{},{},{}]
}