grid: keeping first row fixed (irrespective of sort)
i have an grid application which has an editable "filter criteria" as its first row - as such, i need a way to keep this row as the top row of the grid (i.e. always immediately beneath the header), whilst still allowing sort functionality on the rows beneath.
i thought i could achieve this by constructing a function to pass to grid.setCellValue() which guarantees that the filter criteria row is at the top:
simplistically, it returns a big value when it detects a descending order for the given cell, and a small value otherwise.
having tried the code (below) i find that when i click on the column header to re-order, the value returned by getSortDirection() appears not to work for my needs. i have also tried using onSortDirectionChanged() and row.setPosition(), but to no avail...
and ideas?
function(row, col) {
row = parseInt(row);
col = parseInt(col);
if (row == 0) { // "filter criteria" row
// get sort direction for this column
var direction = this.getSortDirection(col);
// assume numeric values (for simplicity)
if (direction == "descending") {
return Number.POSITIVE_INFINITY;
} else {
return Number.NEGATIVE_INFINITY;
}
}
// continue with rest of function...
}
i thought i could achieve this by constructing a function to pass to grid.setCellValue() which guarantees that the filter criteria row is at the top:
simplistically, it returns a big value when it detects a descending order for the given cell, and a small value otherwise.
having tried the code (below) i find that when i click on the column header to re-order, the value returned by getSortDirection() appears not to work for my needs. i have also tried using onSortDirectionChanged() and row.setPosition(), but to no avail...
and ideas?
function(row, col) {
row = parseInt(row);
col = parseInt(col);
if (row == 0) { // "filter criteria" row
// get sort direction for this column
var direction = this.getSortDirection(col);
// assume numeric values (for simplicity)
if (direction == "descending") {
return Number.POSITIVE_INFINITY;
} else {
return Number.NEGATIVE_INFINITY;
}
}
// continue with rest of function...
}
macabstract
September 6,