PDA

View Full Version : Sort order for GroupingStore or GroupingView



serverfreak1982
2 Dec 2010, 11:09 AM
Hi guys,

I make use of an GroupingStore and View to display items grouped per year.

The items in these groups are sorted correctly (descending by invoice number).
However, the groups itself are ordered ascending - so 2009 is above 2010.

Is there any way to change the sort order for the GroupingView?



var invoiceStore = new Ext.data.GroupingStore({
url: 'fin/getInvoiceList.php',
idProperty: 'ReNr',
autoLoad: true,
autoDestroy: true,
reader: new Ext.data.JsonReader(
{root: 'Invoices'},
[
{name: 'ReNr'},
{name: 'Datum'},
{name: 'Jahr'},
{name: 'Betrag'},
{name: 'Status'}
]),
sortInfo: {
field: 'ReNr',
direction: 'ASC'
},
groupField: 'Jahr'
});


view: new Ext.grid.GroupingView({
forceFit: true,
hideGroupedColumn: true,
showGroupName: false,
groupOnSort: true,
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Rechnungen" : "Rechnung"]})'
}),

msinn
8 Dec 2010, 5:53 AM
hi, did you find the solution for that?

Condor
8 Dec 2010, 6:12 AM
groupDir: 'DESC'

msinn
8 Dec 2010, 6:15 AM
thank you Condor

serverfreak1982
12 Dec 2010, 3:42 PM
As Condor said,
groupDir: 'DESC' will help you.
Sometimes I get lost in the API :-D