Forum


02:12

19/08/2009

Hi,
I've got a grid in edticell mode (using version 3.5) and when it loads I have the top row autoselected - doing that in the
loadComplete event.
var selRow = jQuery("#grid").getGridParam('selrow');
var recNum = jQuery("#grid").getGridParam('reccount');
if (selRow == null && recNum > 0) {
jQuery("#grid").editCell(0, 0);
}
That works fine - highlights the first row for me and enables keyboard navigation on the cells. Now I'd also like to make the first cell be selected, or even have it go to edit mode.
Currently when I load the grid with the above code I can then press the left arrow to select the first cell, and then enter to go into edit mode. Can I somehow pass those keypresses in automatically through code?
I have tried:
jQuery("#grid").trigger("keypress", [13]);
But that does not work.
Does anyone have any suggestions?
Thanks,
Jo
04:46

Moderators
30/10/2007

Hello,
Try this
if (selRow == null && recNum > 0) {
jQuery(”#grid”).editCell(0, 0, true);
}
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
50 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66