Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by dafoink on Jun 09, 2009 05:55
open dhtmlx forum
set focus to a grid after it loads

is there a way to set focus to the grid so that once the grid loads, the user can then immediately be able to arrow up/down in the grid?

I have a form that is bringing back data as an XML string based on filter. what I want to do is once the data comes back, that the focus then goes to the grid so the user can take action.
Answer posted by Alex (support) on Jun 09, 2009 07:26

You can try to use the following approach to set focus the grid cell:

grid.selectCell(0,0,0,0,1);
grid._key_events["k9_0_0"].call(grid);
grid.editStop();

Here grid is grid object. You can call this approach after xml loading

Answer posted by dafoink on Jun 10, 2009 10:20

this helped, but it still didnt set focus to the grid.  so, I ended up doing this (NOTE:  I am using .NET and their scriptmanager).  things are working now.  thanks for the help.

 

mygrid.clearAll();

mygrid.parse(result);

mygrid.selectCell(0, 0, 0, 0, 1);

mygrid._key_events["k9_0_0"].call(mygrid);

mygrid.editStop();

$get('gridbox').focus(); // gridbox is the id of my <div/> tag containing the grid.

return (false);

Answer posted by Alex (support) on Jun 11, 2009 00:42
So... Is the problem solved ?
Answer posted by dafoink on Jun 11, 2009 11:16

yes.  problem solved.

thank you.