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

Keyboard to select a row, not activate it

7 Answers 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael Arocho
Top achievements
Rank 2
Michael Arocho asked on 08 Sep 2009, 07:35 PM
Hi,

I am trying to figure out how to disable the "active row" functionality.  I have no need for an active row, but i want to do keyboard up down selection.  I want it to be selected, not activated.  I want no distinction between an active row and a selected row.  I have tried javascript functions like

set_activeRow

and

grid.MasterTableView.SetActiveRow

Each of these does nothing.  Can i just disable the active row concept all together?

7 Answers, 1 is accepted

Sort by
0
Michael Arocho
Top achievements
Rank 2
answered on 08 Sep 2009, 07:53 PM
I got activation to work when a row is selected by using

grid.SetActiveRow

but when the page loads i am pre-selecting one of the rows.  How from that code behind do i also say "Make this row active in addition to being selected"
0
Mira
Telerik team
answered on 09 Sep 2009, 03:05 PM
Hi Michael,

Please take a look at the Synchronizing keyboard navigation and row selection help topic and tell me whether it works for you.
If you want keyboard navigation enabled, you can not
disable the active row concept - the currently active row is used as a start point for the navigation.

Regards,
Mira
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Michael Arocho
Top achievements
Rank 2
answered on 09 Sep 2009, 03:15 PM
That will not work for me as i have to pre-select an item in the page load and i have no way of defaulting the active row to the selected row from codebehind
0
Accepted
Mira
Telerik team
answered on 11 Sep 2009, 11:53 AM
Hello Michael,

To select a row and make it active so that the user can start navigating with the keyboard after the initial load of the page I recommend that you use the following code:
Code-behind:
    protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!Page.IsPostBack) 
        { 
            RadGrid1.Focus(); 
            RadGrid1.SelectedIndexes.Add(0); 
        } 
    } 
 
Javascript:
function RowSelected(sender, args) { 
                var grid = $find(sender.get_id()); 
                { 
                    grid.set_activeRow($get(args.get_id())); 
                } 
            } 

I am also attaching a sample project showing how this approach works. Please take a look at it.

Regards,
Mira
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Brian Azzi
Top achievements
Rank 1
answered on 18 Mar 2010, 03:59 PM
I guess maybe I'm missing something here, but I can't get the code in the follow example to work (it spins some sort of jscript loop & times out my browser).


Further, if I look at the grid examples online, they don't seem to act correctly with keyboard navigation. Once you move up and down with a row, you seem to never be able to select a row again (even with the mouse)?

I really don't understand how the "active row" navigation is meant to behave... why was this made to be the default behavior? I've not seen many examples of windows that behave this way. It also isn't how windows explorer works to navigate through directory items (for example). 

I really just want to do row selection with arrow up down navigation... its a simple thing, but I can't seem to get it to work. With the skin i'm using it always changes to a outline border instead of a selected row (Windows7 skin). I did notice some other skins seem to work better in this regard...

Thanks,
-Brian
0
Brian Azzi
Top achievements
Rank 1
answered on 18 Mar 2010, 04:25 PM
Just a follow-up... here is what worked for me. I simply hooked up only one of the example jscript functions:

function RowSelected(sender, args) 
     var grid = $find(sender.get_id()); 
     grid.clearActiveRow(); 

0
Mira
Telerik team
answered on 24 Mar 2010, 03:20 PM
Hi Brian,

You should handle only one of the ActiveRowChanged and RowSelected events of the grid - either set the currently active row as selected, or set the selected row as active, otherwise an infinite recursion occurs.

The active row concept is to be used as a start point for the keyboard navigation. If you want keyboard navigation, active row cannot be disabled.

Best wishes,
Mira
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Michael Arocho
Top achievements
Rank 2
Answers by
Michael Arocho
Top achievements
Rank 2
Mira
Telerik team
Brian Azzi
Top achievements
Rank 1
Share this question
or