3.2.0

adding a row in a sorted grid

The default behavior of the grid is to add a row at the end of the grid and scroll down to it. This does not fit the need to add a row in a sorted grid and to scroll to the newly inserted row.

I have changed the given example to sort the grid after adding a row but I am still missing how to scroll to a given row. SetScrollTop is expecting a value in pixel! Even if I get the nb of pixels by the line height (plus border?) I still would need to get the index of the row after sorting. Any clue?


obj.onRowAdded = function(row){
window.status = "Row added: " + row;
this.setCellText("new", 0, row);
var column = this.getSortColumn();
var direction= this.getSortDirection(column);
this.sort(column,direction);
}
Philippe Marzin
October 13,
check setRowPosition and setCurrentRow
October 13,
It works perfectly. thanks.

this.setScrollTop( this.getRowPosition() * this.getRowHeight() );
Philippe Marzin
October 13,
obj.onRowAdded = function(row){
window.status = "Row added: " + row;
this.setCellText("new", 0, row);
var column = this.getSortColumn();
var direction= this.getSortDirection(column);
this.sort(column,direction);
var pos= this.getRowPosition(row);
var h= pos * this.getRowHeight();
this.setScrollTop( h );
}
Philippe Marzin
October 13,

This topic is archived.

See also:


Back to support forum