I've done this function:
function setActiveRow(p) {
var grid = $find("<%=RadGridDati.ClientID%>");
var masterTableView = grid.get_masterTableView();
masterTableView.get_dataItems()[p].get_element().cells[0].focus();
}
where p is the row number I want to set the focus.
It's running correctly with Explorer but not with Firefox and Crome.
Some ideas?
Thanks in advan ce
5 Answers, 1 is accepted
This method is a shortcut for .on( "focus", handler ) in the first and second variations, and .trigger( "focus" ) in the third.The focus event is sent to an element when it gains focus. This event is implicitly applicable to a limited set of elements, such as form elements (<input>, <select>, etc.) and links (<a href>). In recent browser versions, the event can be extended to include all element types by explicitly setting the element's tabindex property. An element can gain focus via keyboard commands, such as the Tab key, or by mouse clicks on the element.Elements with focus are usually highlighted in some way by the browser, for example with a dotted line surrounding the element. The focus is used to determine which element is the first to receive keyboard-related events.
for more detail please check : focus()
In short either you have to assign tabindex to column or you have to add text inside anchor tag.
Let me know if you have any concern.
Thanks,
Jayesh Goyani
Hi Jayesh,
I know this thread is a bit old but I have the same problem and I don't understand how to resolve this. Could you help me please.
Thanks,
Honza
If you are using the Batch editing mode:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx
You can use the openCellForEdit method to achieve this requirement:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/client-side-api
I hope this will prove helpful.
Regards,
Eyup
Telerik by Progress
Hello Eyup,
thank you for tip but my problem is different. Here is my problem. I've got RadTextBox used as a filter for a datasource for RadGrid. And my task is when user use down arrow to allow him to move across rows in RadGrid and select part after enter is pressed. Everything works fine except of grid selecting. I am able to select first row with a script, keyboard navigation is allowed but user has to "activate" grid with click or with the tab pressing...
In IE it's working correctly but any other browser need to select my RadGrid.
Is there any way to get my page working as is required?
Thank you for any help
You can get the grid element using script logic when the page is loaded and call the focus() method. Alternatively, you can hint your user to use some kind of focusing key combination, for example Ctrl+Y:
http://demos.telerik.com/aspnet-ajax/grid/examples/accessibility-and-internationalization/keyboard-support/defaultcs.aspx
Regards,
Eyup
Telerik by Progress