PDA

View Full Version : Grouping and Paging not working



giovanni
1 Jul 2010, 10:21 AM
Paging is server side, that's fine. However regardless of what the totalProperty value is, only the first 25 records are ever shown and it doesn't page. Am I missing something? Works fine if I don't do grouping. I'm using the locking grid column but get the same problem if I remove that.




var m_DS = new Ext.data.GroupingStore({
autoDestroy: false,
proxy: new Ext.data.HttpProxy({
url: './json/m.cfm',
timeout: 60000 // milliseconds
}),
storeId: 'm_DS',
baseParams:{
action: 'getM',
cType: cType,
membercompanyid: 0
},
groupField: 'status',
sortInfo:{
field: 'status',
direction: 'ASC'
},
remoteSort: false,
groupOnSort: false,
reader: new Ext.data.JsonReader({
idProperty: 'membercompanycatalogid',
root: 'data',
totalProperty: 'totalRecords',
fields:[
{name: 'membercompanycatalogid', type: 'int'},
{name: 'membercompanyid', type: 'int'},
{name: 'mpc', type: 'string'},
{name: 'gtin', type: 'string'},
{name: 'upc', type: 'string'},
{name: 'desc', type: 'string'},
{name: 'pack', type: 'string'},
{name: 'size', type: 'string'},
{name: 'brand', type: 'string'},
{name: 'tagged_multi', type: 'string'},
{name: 'validgtin', type: 'int'},
{name: 'status', type: 'string'},
{name: 'ti', type: 'string'},
{name: 'nw', type: 'string'}
]

})

});


var m_bb = new Ext.PagingToolbar({
id: 'm_bb',
pageSize: 25,
store: m_DS,
displayInfo: true,
displayMsg: 'Displaying {0} - {1} of {2}',
emptyMsg: '<b style="color:red;">No Records Found</b>',
refreshText: 'Refresh View',
nextText: 'Next',
prevText: 'Previous'
});


var m_ColumnModel = new Ext.ux.grid.LockingColumnModel({
defaults:{
sortable: true,
groupable: false,
width: 125,
groupRenderer: statusGroupRenderer
},
columns: m_col_headers
})


var m = {
xtype: 'grid',
id: 'm',
store: m_DS,
cm: m_ColumnModel,
sm: m_sm,
columnLines: true,
loadMask: true,
bbar: m_bb,
border: false,
view: new Ext.ux.grid.LockingGroupingGridView({
hideGroupedColumn : true,
forceFit: false,
groupTextTpl: '{text} - {[values.rs.length]} {[values.rs.length > 1 ? "" : ""]}',
startCollapsed: false

}),
listeners: {
render: function(el){
bb = el.getBottomToolbar();
bb.addSeparator();
bb.addText("Per Page");
bb.addField(m_pagingCombo);
bb.addSeparator();
},

}
};




I'm sure it's something simple I'm just not seeing it. Thanks!

Condor
2 Jul 2010, 4:17 AM
Are you sure you are returning the correct totalRecords value?

Can you post some example data?

giovanni
2 Jul 2010, 8:33 AM
Positive. If I change to a simple JsonStore the paging works correctly. Is the grouping store paging supposed to work locally? Because if I remove the paging at the server side and let all records return then the grouping store does page locally but that's not want I want as eventually there will be possibly 10K + records returned.

giovanni
2 Jul 2010, 10:22 AM
Okay the problem is because in other parts of the application they are using the UX PagingStore and if I comment out in the pagingStore.js file the following:



Ext.ux.data.PagingGroupingStore = Ext.extend(Ext.ux.data.PagingStore, Ext.copyTo({}, Ext.data.GroupingStore.prototype, [
'constructor',
'remoteGroup',
'groupOnSort',
'groupDir',
'clearGrouping',
'groupBy',
'sort',
'applyGroupField',
'applyGrouping',
'getGroupState'
]));
Ext.reg('paginggroupingstore', Ext.ux.data.PagingGroupingStore);


Then paging works remotely. I was under the impression that the above code would create a Local Paging Grouping store based upon the grouping store but not over write the standard grouping store which seems to be the case.

Condor
2 Jul 2010, 11:54 PM
Yes, that will break the GroupingStore constructor.

I'll try and fix it...