set selected row before page loads
Hi,
I found no way to pre-selcet a certain row in the table when the page loads.
prior to version 2 the following code used to do that:
obj.setSelectionProperty("index","1");
I am using a single-row selection model and obj.setSelectedRows([2]) makes the first row disappear altogether.
My full code which does not work is as follows:
var myData = [["a","b","c",],["a","b","c",],["a","b","c",],];
var myColumns = ["s","s","s",];
var obj = new AW.UI.Grid;
obj.setId("tabulated_data1");
obj.setRowCount(3);
obj.setColumnCount(3);
obj.setCellText(myData);
obj.setHeaderText(myColumns);
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
obj.setSelectionMode("single-row");
obj.setSelectorWidth(28);
obj.setHeaderHeight(20);
obj.setSelectedRows([1]);
document.write(obj);
Thanks for your help
I found no way to pre-selcet a certain row in the table when the page loads.
prior to version 2 the following code used to do that:
obj.setSelectionProperty("index","1");
I am using a single-row selection model and obj.setSelectedRows([2]) makes the first row disappear altogether.
My full code which does not work is as follows:
var myData = [["a","b","c",],["a","b","c",],["a","b","c",],];
var myColumns = ["s","s","s",];
var obj = new AW.UI.Grid;
obj.setId("tabulated_data1");
obj.setRowCount(3);
obj.setColumnCount(3);
obj.setCellText(myData);
obj.setHeaderText(myColumns);
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
obj.setSelectionMode("single-row");
obj.setSelectorWidth(28);
obj.setHeaderHeight(20);
obj.setSelectedRows([1]);
document.write(obj);
Thanks for your help
Adi
July 28,
How about you put obj.setSelectedRows([1]); after document.write(obj);?
flashsnake
July 28,
Hi,
Thanks for your advice but it is exactly the same result...
The first row in the table does not come up at all.
Try for yourself and see..
Ideas anyone ? this seems a really simple feature.
Thanks for your advice but it is exactly the same result...
The first row in the table does not come up at all.
Try for yourself and see..
Ideas anyone ? this seems a really simple feature.
Adi
July 29,
sorted ir out!
Another post on the forum describes a bug in v2.0 and a workaround.
So now it is ok.
Another post on the forum describes a bug in v2.0 and a workaround.
So now it is ok.
Adi
July 30,
This topic is archived.
See also:
This example shows how to Drag and Drop Rows in a v2.0 Grid to change the row order
Rob Francis
(59)
PAGING with Version 2.0
K.P
(28)
Is there a way to set focus on the first row automatically??
Roger Mutangadura
(12)
How to set row color based on some column value?
Andrew
(11)
Set NO rows selected
Fily84
(7)
Select all rows - Performance problem
Claudia
(9)
Set input limit for grid row?
Rajeem
(10)
addRow when using multi-row-marker sets the first row as selected
Eric York - Liberty Mutual
(4)
Back to support forum