Rad Grid Set Focus on row

6 posts, 0 answers
  1. Paolo
    Paolo avatar
    1 posts
    Member since:
    Sep 2014

    Posted 25 Sep 2014 Link to this post

    I've a rad grid and I want to set the focus on a specified row of the grid using javascript.

    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
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 25 Sep 2014 in reply to Paolo Link to this post

    Hi,

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. KTK
    KTK avatar
    11 posts
    Member since:
    Oct 2013

    Posted 15 Nov in reply to Jayesh Goyani Link to this post

    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

  5. Eyup
    Admin
    Eyup avatar
    3009 posts

    Posted 18 Nov Link to this post

    Hello 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
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
  6. KTK
    KTK avatar
    11 posts
    Member since:
    Oct 2013

    Posted 25 Nov in reply to Eyup Link to this post

    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

  7. Eyup
    Admin
    Eyup avatar
    3009 posts

    Posted 30 Nov Link to this post

    Hi Honza,

    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
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017