Skip to content

Commit d34e143

Browse files
sort order indicator
1 parent f9751ef commit d34e143

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

source/css/LightPivot.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@
215215
background: #FFF7D7;
216216
}
217217

218+
.lpt-sortDesc:before {
219+
content: "▼ ";
220+
}
221+
222+
.lpt-sortAsc:before {
223+
content: "▲ ";
224+
}
225+
218226
/*.lpt .lpt-leftHeader table {*/
219227
/*margin-bottom: 10em;*/
220228
/*}*/

source/js/DataController.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,12 @@ DataController.prototype.sortByColumn = function (columnIndex) {
537537
this.SORT_STATE.order = order;
538538
this.SORT_STATE.column = columnIndex;
539539

540+
for (var i in data.rawData[data.info.topHeaderRowsNumber - 1]) {
541+
if (data.rawData[data.info.topHeaderRowsNumber - 1][i].className) {
542+
delete data.rawData[data.info.topHeaderRowsNumber - 1][i].className;
543+
}
544+
}
545+
540546
if (order === 0) {
541547
data.rawData = data._rawDataOrigin;
542548
this._trigger();
@@ -554,6 +560,9 @@ DataController.prototype.sortByColumn = function (columnIndex) {
554560
data.rawData = data._rawDataOrigin.slice(0, data.info.topHeaderRowsNumber)
555561
.concat(newRawData)
556562
.concat(this.SUMMARY_SHOWN ? [data._rawDataOrigin[data._rawDataOrigin.length - 1]] : []);
563+
data.rawData[data.info.topHeaderRowsNumber - 1][data.info.leftHeaderColumnsNumber + columnIndex]
564+
.className = order === 0 ? "" : order === 1 ? "lpt-sortDesc" : "lpt-sortAsc";
565+
557566

558567
this._trigger();
559568

source/js/PivotView.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ PivotView.prototype.renderRawData = function (data) {
614614
tr.appendChild(th = document.createElement("th"));
615615
th.textContent = rawData[y][x].value;
616616
if (rawData[y][x].style) th.setAttribute("style", rawData[y][x].style);
617+
if (rawData[y][x].className) th.className = rawData[y][x].className;
617618
if (rawData[y][x].group) renderedGroups[rawData[y][x].group] = {
618619
x: x,
619620
y: y,

0 commit comments

Comments
 (0)