|
Rank: Advanced Member Groups: Member
Joined: 7/21/2008 Posts: 90
|
Hi,
I was just wondering if dropdown list item can be selected through keyboard. What I mean to say is let's say when you press <Enter> then the dropdown list appears and then select an item through keyboard instead of using mouse.
Vinny
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
You can activate the drop down with keyboard but you won't be able to select an item through keyboard. In order to activate the drop down with keyboard, you would set the Grid:
1. EnableKeyboardNavigation to true; 2. Not required, but you usually need to set the Selected style, otherwise when you press arrow key to move the current focus cell, it moves but you won't be able to tell that it moved;
Unfortunately once EnableKeyboardNavigation is set, all arrow keys are interpreted as moving current cells. Thus it became impossible to use arrow keys to select a list item.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 7/21/2008 Posts: 90
|
Ok. Thanks.
|
|
Rank: Advanced Member Groups: Member
Joined: 7/21/2008 Posts: 90
|
Hi, Is there any way to put validations in cells like number or date validation?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
The Grid won't do that for you. It's doable with CustomColumn, but it will be quite some code on your side. Since anyway you will be validating on the server side, it will be up to you to decide whether validating on the client side worth the effort.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 7/21/2008 Posts: 90
|
Is it possible to have a small example let's say about only numbers in cell?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
You may want to take a look of MaskedEditColumn. That might already provided what you need.
Unfortunately we will not be able to provide additional samples for CustomColumn. The reason is because the very purpose of the CustomColumn is to give you an interface to implement whatever logic you wish to have, thus our samples for CustomColumn are limited to demonstrating the interface, not the implementation. Taking the interface aside, the implementation would be totally up to you and virtually has nothing to do with our product. (For example, implementing a number-only cell is no different than implementing a number only textbox). For that reason we do not provide additional samples that go beyond demonstrating the interface.
Please feel free to let us know if you do have questions about the interface. We will be happy to help.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 7/21/2008 Posts: 90
|
Thanks. I'll look into MaskedEditColumn and see how much it can help.
|
|
Rank: Member Groups: Member
Joined: 7/27/2012 Posts: 12
|
eo_support wrote: 1. EnableKeyboardNavigation to true; 2. Not required, but you usually need to set the Selected style, otherwise when you press arrow key to move the current focus cell, it moves but you won't be able to tell that it moved;
Unfortunately once EnableKeyboardNavigation is set, all arrow keys are interpreted as moving current cells. Thus it became impossible to use arrow keys to select a list item.
Hello I'm new to EO Web and I have the same problem as mentioned 4 years ago on this topic... Except that Masked Edit isn't an option for us. This being said, and bearing in mind that I'm completely new to this control, it seems to me that it would be an easy fix with only one extra javascript function grid.setEnableKeyboardNavigation(isEnabled) My idea is as follow: 1. Start out with a grid.EnableKeyboardNavigation=True 2. ClientSideOnCellSelected if column is dropdown set focus on control 3. grid.EnableKeyboardNavigation=False 4. At that moment (i.e. dropdown focused,no keyboard navigation on grid) keys should work for us. 5. On loss of focus, grid.EnableKeyboardNavigation=True, and continue navigating Maybe flipping the EnableKeyboardNavigation switch, client-side, isn't in the realm of possibilities. But if not, it would be a very nice feature to have.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi, Thanks for the feedback. There is direct way to toggle EnableKeyboardNavigation on the client side. However one indirect workaround is to set the focus to somebody else. It will be something like this:
Code: JavaScript
function begin_edit_handler()
{
//Put the real focus to the drop down box. It is
//necessary to use setTimeout here to delay the
//call because at this moment the list box is not
//displayed yet
var list = document.getElementById("list");
setTimeout(function()
{
list.focus();
}, 10);
//At the same time tells EO library that the focus
//is at a different EO control so that EO won't send
//keyboard event to the current Grid
var dummy_grid = eo_GetObject("dummy_grid");
dummy_grid.focus();
}
Code: HTML/ASPX
<eo:Grid runat="server" ID="dummy_grid">
.....
</eo:Grid>
<eo:Grid runat="server" ID="real_grid">
.....
<Columns>
<eo:CustomColumn ClientSideBeginEdit="begin_edit_handler">
<EditorTemplate>
<select id="list">
<option>Item 1</option>
<option>Item 2</option>
</select>
</EditorTemplate>
</eo:CustomColumn>
</Columns>
</eo:Grid>
The problem for this method is you must also handle keyboard events on the select element so that you can "bring the focus back" to the real_grid when needed (for example, when user presses left/right arrow), and that part may not be trival if you do not already have similar code as keyboard event codes various on different browsers. Thanks!
|
|
Rank: Member Groups: Member
Joined: 7/27/2012 Posts: 12
|
Thank you very much! This was very helpful. eo_support wrote:... There is direct way to toggle EnableKeyboardNavigation on the client side. Can you please elaborate on this, it may be useful for what we want to do.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Sorry about that. We meant "there isn't", not "there is". Sorry about it!
|
|