3.0 beta 2

Is there a way to set focus on the first row automatically??

I have used the grid on one of my applications and frankly i think that the grid is amazing.

I would like to know if it is possible such that when my page loads, the focus is automatically set to the first row.

Any help is most welcome.
Roger Mutangadura
November 30,
see in the example quickref/grid.htm, the line:

obj.setCurrentRow(1);
Will
November 30,
This didn't work for me ...
obj.setCurrentRow(1);


That appears to scroll the grid.


However, to select the first row I used...
obj.setSelectedRows([0]);
Rob Francis
November 30,
"obj.setSelectedRows([0]);" only highlight not focus. The following 2 lines will do highlighting and focusing to first row.

obj.setSelectedRows([0]);
aw50.focus();
Qing
March 3,
The grid name change, so the above code "aw5o" cause error, use these to replace the code above:
<CODE class=aw-code-block>
try{obj.setSelectedRows([0]);}catch(e){;}
gGirdId = obj.getId();
try{setTimeout("document.getElementById(gGirdId).focus();",500);}catch(e){;}
</CODE>
Qing
March 3,
I mean:
try{obj.setSelectedRows([0]);}catch(e){;}
gGirdId = obj.getId();
try{setTimeout("document.getElementById(gGirdId).focus();",500);}catch(e){;}
Qing
March 3,
This does not work!! If I select ANY row, the first row never is displayed. Even setCurrentRow does not work! This a bug!!
Karl
September 8,
This is very much effective and helpfull

thanx.
Maksud Belim
September 13,
hi

and if i want to start editing, at the moment the row is just focus

Thanks in advance
Nuno Silva
September 28,
This worked for me:

grid.setSelectionMode("single-row");
grid.setSelectedRows([0]);
This need to be added in the code before:
grid.setCellText(tableContent);
Otherwice the first row is not shown in the grid

Linda
October 25,
this worked for me:

insert this block before the call to grid.setcelltext:

grid.setSelectionMode("single-row");
grid.setSelectedRows([0]);

Then I had to call the grid.setSelectedRows([0]); after the grid.setcelltext(..) call.
This was the only way to get this working without hiding the first row in the grid.
Linda
October 25,
I worked on this for a long time in my project.
I had to call this code after obj.setCellData(..) and obj.setRowCount(..) and any cell formating.
Some of the obj.refresh() may be redundant but it worked for me.
Basically I set focus to the second row and bac to the first.

obj.clearSelectionModel();
obj.refresh();

obj.setSelectedRows([1]);
obj.setCellSelected(); 
       
obj.refresh();
obj.setSelectedRows([0]);

obj.refresh();
Colin P.
October 25,
Hi,
this worked for me:

...
obj.setSelectionMode("single-row");
obj.setSelectedRows([0]);
obj.setSelectedRows([0]);
...
Luca
December 7,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.