3.2.0

scroll current/selected row on top

Hi all

I want set the current and selected row and then to scroll this one to the top of grid. Can someone tell me what is wrong with this code?

<script>
var grid = new AW.UI.Grid;
grid.setId("myGrid");
grid.setCellData(function(col, row){return "cell " + col + "." + row});
grid.setColumnCount(5);
grid.setRowCount(20);
grid.setSelectionMode("single-row"); // set selection mode to single row
grid.setCurrentRow(14);
grid.setSelectedRows([14]);
grid.refresh();

alert( "grid.getCurrentRow(): " + grid.getCurrentRow());
alert( "grid.setSelectedRows([0]): " + grid.getSelectedRows([0]));

document.write(grid);

</script>

Thanks,
Adrian
Adrian
April 1,
You should not use grid.refresh() and later document.write(grid) - use either one or another but not both. Also you can use grid.selectRow(14) instead of setCurrentRow, setSelectedRows. If it does not help - try calling selectRow after some delay -

document.write(grid);
grid.setTimeout(function(){
this.selectRow(14);
}, 1000);
Alex (ActiveWidgets)
April 5,

This topic is archived.

See also:


Back to support forum