PDA

View Full Version : GroupingStore with remoteSort: true does not work



fabiojpoli
5 Oct 2010, 8:26 AM
Good morning, I got a little problem, I think that is so bug Ext researched, but so far not found any solution or override .. I use the Rodrigo override this at the moment to facilitate the cluster:


Ext.data.JsonGroupingStore = function(c){
Ext.data.JsonGroupingStore.superclass.constructor.call(this, Ext.apply(c, {
proxy: c.proxy || (!c.data ? new Ext.data.HttpProxy({url: c.url}) : undefined),
reader: new Ext.data.JsonReader(c, c.fields)
}));
};

Ext.extend(Ext.data.JsonGroupingStore, Ext.data.GroupingStore, {});


this.storeMovimentacoes = new Ext.data.JsonGroupingStore({
remoteSort: true,
root: 'rows',
idProperty: 'id',
totalProperty: 'total',
url : 'include/tesouraria/movimentacaoAction.php?action=listarMovimentacoes',
groupField:'departamento',
baseParams: { start:0, limit:40 },
fields: [
{name : 'id', type : 'int'},
{name : 'departamento', type : 'string'},
{name : 'tipo_movimentacao', type : 'string'},
{name : 'data_movimentacao', type : 'date', dateFormat: 'Y-m-d'},
{name : 'responsavel', type : 'string'},
{name : 'valor', type : 'float'}
]
});

it loads right first time, but when you choose to group by another column, returns me the following error:


sorters[0] is undefined

Line 22112


if (this.remoteSort) {
22112 this.singleSort(sorters[0].field, sorters[0].direction);
22113
22114 } else {
22115 this.applySort();
22116 this.fireEvent('datachanged', this);
22117 }

Thanks!

plalx
5 Oct 2010, 11:23 AM
Try to pass a sortInfo config to your store.

e.g.



sortInfo: {
field: 'id',
direction: 'ASC'
}

fabiojpoli
5 Oct 2010, 1:51 PM
Try to pass a sortInfo config to your store.

e.g.



sortInfo: {
field: 'id',
direction: 'ASC'
}


Now my store is like this:



this.storeProfessores = new Ext.data.JsonGroupingStore({
remoteSort: true,
root: 'rows',
//idProperty: 'id_pessoa',
totalProperty: 'total',
url : 'include/ebd/professorAction.php?action=listarProfessores',
groupField:'nome',
sortInfo:{field: 'nome', direction: "ASC"},
baseParams: { start:0, limit:40 },
fields: [
{name : 'id_pessoa', type : 'int'},
{name : 'nome', type : 'string'},
{name : 'id_classe', type : 'int'},
{name : 'classe', type : 'string'}
]
});


By default, comes bundled under the 'Professor'
If step group by "Classe", works perfectly
back to the group by "Professor" is still working
But if after all this I turn to group by "Classe" returns me the error mentioned above (image)22685