I have more than 1 grid on my page, as well as other buttons, tabs and regular HTML form fields.
I am having trouble controlling the focus of the grids when the user selects other fields and buttons on my page.
1) In IE & FF, when i mouse-click on the page or on a form field OUTSIDE of the grid, the last grid cell being edited remains hilighted/selected.
2) In IE, when I use “accesskey” (alt+key) to place focus on an href element elsewhere on my page, the focus goes there, but as soon as I press TAB, focus jumps back to the last cell being edited in the grid.
3) Many more examples…
Basically, can you just tell me what functions I can call to KILL THE FOCUS AND/OR SELECTION on the grid?
I have tried playing with “grid.setActive(true|false)”, and the “grid._still_active” property, but these seem to have no effect at all.
when i mouse-click on the page or on a form field OUTSIDE of the grid, the last grid cell being edited remains hilighted/selected
The only situation when such behavior possible - you have some custom onclick handlers assigned to the page elements, which block event propagation. Grid liste “onclick” event on document.body, and if event blocked on some high level elements, grid will not known about click event and will not react on it.
>>Basically, can you just tell me what functions I can call to KILL THE FOCUS AND/OR SELECTION on the grid?
grid.setActive(true); //move focus to the grid
grid.setActive(false); //mark grid as not focused
Beware that any mouse activity in grid ( clicking, dragging, etc.) will make grid active.
Also , some API calls, such as selectRow mark grid as active.
In case of IE, if you plan to control active state of grid manually, it has sense to add next line to the grid’s init
It will disable auto-focusing of grid in IE.
How to focus on particular cell?
It will switch cell to edit state and will move active focus inside cell’s editor