Skip to content

Commit c1aa0dc

Browse files
committed
example-footer-totals: support row reorder and make sure the function uses the reordered column list from the grid rather than the local copy of the initial column array
1 parent 46530cf commit c1aa0dc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

examples/example-footer-totals.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ <h2>View Source:</h2>
6767
}
6868

6969
function UpdateAllTotals(grid) {
70-
var columnIdx = columns.length;
70+
var columnIdx = grid.getColumns().length;
7171
while (columnIdx--) {
7272
UpdateTotal(columnIdx, grid);
7373
}
7474
}
7575

7676
function UpdateTotal(cell, grid) {
77-
var columnId = columns[cell].id;
77+
var columnId = grid.getColumns()[cell].id;
7878

7979
var total = 0;
8080
var i = data.length;
@@ -100,6 +100,10 @@ <h2>View Source:</h2>
100100
grid.onCellChange.subscribe(function(e, args) {
101101
UpdateTotal(args.cell, args.grid);
102102
});
103+
104+
grid.onColumnsReordered.subscribe(function(e, args) {
105+
UpdateAllTotals(args.grid);
106+
});
103107
})
104108
</script>
105109
</body>

0 commit comments

Comments
 (0)