Total line simulation
Until the next release with the promised total line in it, here's a way to simulate it, sorta...
1. Manually total the columns you want and add a row to the bottom of the grid with the totals in it. If you're generating the grid data dynamically like I am, you'll want to increment the value in obj.setRowCount();
2. Change the color of the total line if you wish. Search on 'row color' for past forum messages that cover this.
3. So far so good, but if you now try sorting on a column, all hell breaks loose. So we have to tweak the sort function in grid.js so that it doesn't sort the last line. The code in bold is what I added. This works for me so far, but I imagine there is a more proper way of doing this...
obj.sort = function(index, direction){
.
.
...
var a = {};
var rows = this.getRowProperty("values");
var lastrow = rows.pop():
...
// sort loop here
rows.push(lastrow);
this.setRowProperty("values", rows);
this.setSortProperty("index", index);
this.setSortProperty("direction", direction);
};
1. Manually total the columns you want and add a row to the bottom of the grid with the totals in it. If you're generating the grid data dynamically like I am, you'll want to increment the value in obj.setRowCount();
2. Change the color of the total line if you wish. Search on 'row color' for past forum messages that cover this.
3. So far so good, but if you now try sorting on a column, all hell breaks loose. So we have to tweak the sort function in grid.js so that it doesn't sort the last line. The code in bold is what I added. This works for me so far, but I imagine there is a more proper way of doing this...
obj.sort = function(index, direction){
.
.
...
var a = {};
var rows = this.getRowProperty("values");
var lastrow = rows.pop():
...
// sort loop here
rows.push(lastrow);
this.setRowProperty("values", rows);
this.setSortProperty("index", index);
this.setSortProperty("direction", direction);
};
David Cooke
February 17,