This is a migrated thread and some comments may be shown as answers.

Navigate to filtermenu in grid with keyboard

1 Answer 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
BOS
Top achievements
Rank 1
BOS asked on 29 Mar 2011, 10:05 AM
I've search around the forum trying to find a way to navigate a grid only using the keyboard and I have found some solutions, but not all works.
So far I can focus on the grid and navigate between rows and pages, but I need a way to enter sorting and the filtermenu - I can't get the example from the forum with the FocusMenu function to work.

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function FocusMenu(menu, eventArgs) 
            {
                menu.get_items().getItem(0).get_linkElement().focus();
            }
        </script>
    </telerik:RadCodeBlock>    
      
    <telerik:RadGrid ID="RadGridAxOrder" runat="server" 
                     DataSourceID="sdsAxOrderView" 
                     AllowPaging="True" 
                     AllowSorting="True" 
                     AllowFilteringByColumn="True" 
                     GridLines="None" 
                     AutoGenerateColumns="False" 
                     onitemcommand="RadGridAxOrder_ItemCommand" 
                     onprerender="RadGridAxOrder_PreRender">        
        <GroupingSettings CaseSensitive="false" /> 
        <ClientSettings AllowKeyboardNavigation="true" >
            <KeyboardNavigationSettings FocusKey="G" />
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" DataSourceID="sdsAxOrderView">
            <Columns>
                <telerik:GridBoundColumn DataField="ordreNr" 
                    FilterControlAltText="Filter ordreNr column" HeaderText="Ordrenr." 
                    ReadOnly="True" SortExpression="ordreNr" UniqueName="ordreNr">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ordreNavn" 
                    FilterControlAltText="Filter ordreNavn column" HeaderText="Ordrenavn" 
                    SortExpression="ordreNavn" UniqueName="ordreNavn">
                </telerik:GridBoundColumn>
                  
And so on

    protected void RadGridAxOrder_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == "Edit")
        {
            e.Canceled = true;
        }
    }
  
    protected void RadGridAxOrder_PreRender(object sender, EventArgs e)
    {
        RadGridAxOrder.FilterMenu.OnClientShown = "FocusMenu";
    }
}

Note: I don't want the edit-form to be activated - that's the reason for the ItemCommand-event.

I'm also looking for a way to make the filtermenu focused automatically on page load and making the grid focused automatically when the users navigates to another page in the grid.

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 01 Apr 2011, 10:21 AM
Hello,

I have followed your scenario and prepared a sample project for you demonstrating how the desired functionality can be implemented. You can find it attached to this message.
Also, please examine the updated Filtering RadGrid with keyboard code library.

I hope this helps.

Kind regards,
Mira
the Telerik team
Tags
Grid
Asked by
BOS
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or