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

Keyboard Spacebar Select

1 Answer 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 1
Don asked on 02 May 2013, 07:56 PM
In my grid if I have GridCellSelectionMode set to SingleCell, pressing the space bar does not select the row, even if I am on the checkbox cell. Setting it to None allows the selection to work. Is there a way to select the row selection checkbox with the selection mode set to SingleCell?

BTW, it needs to be single cell for the assistive tech reader to read the contents of the cell.

-Don

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 07 May 2013, 12:02 PM
Hello Don,

You can use the following approach:
<ClientSettings AllowKeyboardNavigation="true">
    <Selecting AllowRowSelect="true" CellSelectionMode="SingleCell" />
    <ClientEvents OnKeyPress="keyPress" />
</ClientSettings>
JavaScript:
function keyPress(sender, args) {
    if (args.get_keyCode() == 32) { 
        var rowEl = sender._cellSelection._current[0].parentNode;
        if (rowEl) {
            var checkBox = $(rowEl).children().find("[type=checkbox]")[0];
            checkBox.click();
        }
    }
}

Hope this helps. Please give it a try and let me know if it works for you.

All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Don
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or