PDA

View Full Version : GroupingGrid sort will not work...



muselmanach
11 Sep 2013, 1:23 AM
My grouping grid simply will not sort by "debitorName". What the hell am i doing wrong? It only sorts after "debitorNr"....

Please, need this get working very urgent.

thx
muselmanach


var store = Ext.create('Ext.data.Store', {
autoLoad: true,
autoSync: true,
fields: [
{name: 'billNr', type: 'string'},
{name: 'billDate', type: 'date', dateFormat: 'Y-m-d'},
{name: 'amount', type: "float"},
{name: 'debitorId', type: 'int'},
{name: 'debitorNr', type: 'int'},
{name: 'debitorName', type: 'string'},
{name: 'debitorShortNote', type: 'string'},
{name: 'debitorState', type: 'int'},
{name: 'pledged', type: 'boolean'},
{name: 'done', type: 'boolean'}
],
groupField: 'debitorNr',
groupOnSort: true,
remoteSort: false,
remoteGroup: false,
sorters: [{
property: 'debitorName',
direction: 'ASC'
}],
proxy: getProxy(config.billReadUrl, config.billSaveUrl, config.billDeleteUrl),
listeners: {
load : function(store, records, successful, eOpts ){
store.sort();
}
}
});




new Ext.grid.Panel({
viewConfig: {
trackOver: true
},
id: "content_grid",
region: "center",
frame: true,
loadMask: true,
store: store,
columns: getContentColumns(),
features: shared.getFeatures()
});







this.getFeatures = function() {
return [
Ext.create('Ext.grid.feature.Grouping', {
groupHeaderTpl: '<span style="display:none" class="debitorId">{[values.rows[0].data.debitorId]}</span><span data-qtip="{[values.rows[0].data.debitorShortNote]}">{[values.rows[0].data.debitorName]} </span>',
hideGroupedHeader: true,
startCollapsed: true,
id: "groupingFeature"
})];
}





var getContentColumns = function() {
return [
{text: 'Debitor', dataIndex: 'debitorName', filter: true, hidden: true},
{text: 'DNR', dataIndex: 'debitorNr', filter: true, hidden: true},
{text: 'NR', dataIndex: 'billNr', flex: 1, filter: true},
{text: 'Datum', dataIndex: 'billDate', flex: 1, filter: true,
renderer: function render_date(val) {
val = Ext.util.Format.date(val, 'd.m.Y');
return val;
}
},
{text: 'BU_Betrag', dataIndex: 'amount', flex: 1, filter: true,
renderer: function render_date(val) {
return "€ " + helper.numberWithCommas(val);
}
},
{text: 'Verpfändet', dataIndex: 'pledged', filter: true, xtype: 'booleancolumn', trueText: 'Ja',
falseText: 'Nein'},
{text: 'Erledigt', dataIndex: 'done', filter: true, xtype: 'booleancolumn', trueText: 'Ja',
falseText: 'Nein'}
];
}

ettavolt
11 Sep 2013, 9:35 PM
Can you show some sample data (say 4-6 rows with different 'debitorNr' and 'debitorName') and what output do you want?

muselmanach
11 Sep 2013, 11:46 PM
Here is an example:

debitorName "T" got debitorNr 1
debitorName "Z" got debitorNr 2
debitorName "A" got debitorNr 3

As you can see the grid sorts the groups after the debitorNr instead of the debitorName.
I would need to have the grid sorted ASC by the debitorName and not the debitorNr.

Any ideas what i got wrong or is this a bug?

(i am even calling the store.sort() function after the load event, but this doesnt chang anything)

thx
45770

ettavolt
12 Sep 2013, 1:50 AM
You should about the grouping works - sort is sorted by groupers and then (in those groups) by other sorters.
If debitorNr is equivalent to debitorName (I mean there is 1:1 relation) you should group by debitorName.

muselmanach
12 Sep 2013, 2:15 AM
You should about the grouping works - sort is sorted by groupers and then (in those groups) by other sorters.
If debitorNr is equivalent to debitorName (I mean there is 1:1 relation) you should group by debitorName.

i do sort by "debitorName":



sorters: [{
property: 'debitorName',
direction: 'ASC'
}]


but i doesnt work.

or did i misunderstood you?

(i can't group by "debitorname", because i need the value of "debitorNr" as value for the groupAction)

muselmanach
12 Sep 2013, 3:05 AM
ok i have found a solution i built a hidden span into my grouping header where i am saving my debitorId and my groupActions take this as value, so i can group by debitorName

thx