PDA

View Full Version : Pivot grid aggregation sort



demongloom
28 May 2015, 11:48 AM
Hi all,

Anybody knows how is possible to predefine sort for pivot grid aggregation?

I wrote a snippet do that automatically, but may be a more convenient way is exists.


Ext.define('Ext.overrides.pivot.Grid', { override: 'Ext.pivot.Grid',
reconfigure: function () {
var grid = this;
grid.on('reconfigure', function () {
var matrix = grid.getMatrix();

matrix.aggregate.getRange().forEach(function (agg) {
if (agg.sort) {
matrix.leftAxis.sortTreeByField(agg.dataIndex, agg.sort);
grid.refreshView();
var column = grid.getColumns().filter(function (column) {
return column.text === agg.header;
})[0];
grid.updateColumnSortState(column, agg.sort);
}
});

}, this, {single: true});
this.callParent(arguments);
}
});

ateodorescu
22 Jul 2015, 2:50 AM
What do you want to achieve? I don't really understand what you mean by "predefined sort for pivot grid aggregation".

Each left or top axis dimension can be configured as "sortable" and "direction" of sorting.
In the pivot grid you can click on grid columns and rows are sorted by the aggregated value of that clicked column, given that the column is responsible for a top axis item and not a left axis item.