:: Forum >>
Adjust alternating row colors after delete
I would rather not refresh as it takes times and changes the position of the grid (even if you set focus).
How do you get the current background color setting of a particular row. If I can test against that I can get it, but my attempts to find that answer have proved fruitless.
Michael
Tuesday, September 25, 2007
found the solution
for (var i=line_number_deleted; i<rowcount i++){
obj.getRowTemplate(i).refresh();
}
Michael
Tuesday, September 25, 2007
yes, you could also try refreshClasses() method instead of refresh(). Also if you are using large grid with virtual scrolling than it make sense to stop at the last rendered row - test for obj.getRowTemplate(i).element(). You should also use row index instead of display position - those two might be different after sorting.
var obj = new AW.UI.Grid;
obj.setCellData(function(col, row){return col + "." + row});
obj.setHeaderText("header");
obj.setColumnCount(10);
obj.setRowCount(1000);
document.write(obj);
obj.onRowDoubleClicked = function(event, rowIndex){
var rowPosition = this.getRowPosition(rowIndex);
this.deleteRow(rowIndex);
var rowCount = this.getRowCount();
var rowIndices = this.getRowIndices();
var i, index;
for (i=rowPosition; i<rowCount; i++){
index = rowIndices ? rowIndices[i] : i;
this.getRowTemplate(index).refreshClasses();
if (!this.getRowTemplate(index).element()){
break;
}
}
}
Alex (ActiveWidgets)
Wednesday, September 26, 2007
Thanks refreshclasses is much faster and looks cleaner.
Michael
Wednesday, September 26, 2007
This topic is archived.
Back to support forum
Forum search