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

Override default key event methods

3 Answers 283 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 11 Dec 2014, 04:55 PM
Hi,

We're using numeric textboxes in a grid that allows for keyboard navigation.  The problem is that the up/down arrows still increase and decrease the values in the textbox before the navigation event occurs.  Is there a way to disable the default key events, or modify them?

Thanks,
Kevin

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 13 Dec 2014, 12:22 PM
Hello Kevin,

I am afraid that is not very clear what "navigation" event occurs when value of NumericTextBox is increased/decreased. Could you elaborate more on this requirement?

In general, widget's keyboard navigation is enabled by default and cannot be prevented nor modified. If you need to change widget behavior, then you will need to override its current implementation.

Best regards,
Georgi Krustev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Kevin
Top achievements
Rank 1
answered on 15 Dec 2014, 02:04 PM
Hi George,

To elaborate, we've designed a grid so that when the user presses the arrow keys it shifts focus to the control in that direction.  So the up arrow key moves the focus to the element in the row above, and down arrow sets the focus on the element in the row below.  

This is working but it's also increasing or decreasing the value in the NumericTextBox at the same time.  I was hoping to find out how to disable this increment/decrement behaviour on keypress.

Thanks,
Kevin
0
Accepted
Georgi Krustev
Telerik team
answered on 17 Dec 2014, 08:38 AM
Hello Kevin,

The only way to disable the increment/decrement behavior is to unbind current "keydown" event handler. Here is a Dojo demo that demonstrates one possible implementation. 

Regards,
Georgi Krustev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
NumericTextBox
Asked by
Kevin
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Kevin
Top achievements
Rank 1
Share this question
or