:: Forum >>

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...
}
macabstract
Wednesday, September 6, 2006
Maybe you should just use two header rows (with extended grid)?

var obj = new AW.Grid.Extended;
obj.setHeaderCount(2);
Alex (ActiveWidgets)
Wednesday, September 6, 2006

This topic is archived.


Back to support forum

Forum search