Skip to content

Commit 7d0a8b9

Browse files
fix for summary sorting in some cases
1 parent ce95d89 commit 7d0a8b9

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

example/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
//, hideButtons: true // hides "back" and "drillThrough" buttons
103103
//, triggerEvent: "touchstart" // all "click" events will be replaced by this event
104104
//, caption: "My table" // if set, table basic caption will be replaced by this text
105-
//, showSummary: true // show summary by columns
105+
, showSummary: true // show summary by columns
106106
//, drillDownTarget: "<dashboard name>" // undocumented, deepSee only
107107
};
108108

source/js/DataController.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ DataController.prototype.pushData = function () {
4646

4747
this._dataStack.push(d = {
4848
data: null,
49+
SUMMARY_SHOWN: this.SUMMARY_SHOWN,
4950
SORT_STATE: {
5051
column: null,
5152
order: -1
@@ -66,6 +67,7 @@ DataController.prototype.popData = function () {
6667
this._dataStack.pop();
6768

6869
//this.data = d.data;
70+
this.SUMMARY_SHOWN = d.SUMMARY_SHOWN;
6971
this.SORT_STATE = d.SORT_STATE;
7072

7173
};
@@ -258,6 +260,7 @@ DataController.prototype.resetRawData = function () {
258260
data.info.topHeaderRowsNumber = xh;
259261
data.info.leftHeaderColumnsNumber = yw;
260262
this.SUMMARY_SHOWN = false;
263+
this._dataStack[this._dataStack.length - 1].SUMMARY_SHOWN = false;
261264

262265
var countSummaryByColumn = function (array, iStart, iEnd, column) {
263266
var sum = 0;
@@ -286,6 +289,7 @@ DataController.prototype.resetRawData = function () {
286289
if (this.controller.CONFIG["showSummary"] && rawData.length - xh > 1 // xh - see above
287290
&& (rawData[rawData.length - 1][0] || {})["isCaption"]) {
288291
this.SUMMARY_SHOWN = true;
292+
this._dataStack[this._dataStack.length - 1].SUMMARY_SHOWN = true;
289293
rawData.push(summary = []);
290294
x = rawData.length - 2;
291295
for (var i in rawData[x]) {
@@ -352,8 +356,6 @@ DataController.prototype.sortByColumn = function (columnIndex) {
352356
xIndex = data.info.leftHeaderColumnsNumber + columnIndex,
353357
order = this.SORT_STATE.order === -1 ? 1 : this.SORT_STATE.order === 1 ? 0 : -1;
354358

355-
356-
357359
this.SORT_STATE.order = order;
358360
this.SORT_STATE.column = columnIndex;
359361

0 commit comments

Comments
 (0)