-
4 Jan 2012 7:45 AM #1
DatePicker select Today with SpaceBar shortcut key inserts a space on the field
DatePicker select Today with SpaceBar shortcut key inserts a space on the field
- Detailed description of the problem
In DatePicker when you select the "today" date with the shortcut key (space bar) a space is inserted in the end of the text in the field, making the field marked as invalid.
You can test it in the Birthday DateField the Forms example in the "Explorer Demo" ( http://www.sencha.com/examples/explorer.html#forms )
- Possible solution
One possible working solution is change the onKeyPress(ComponentEvent ce) method of the KeyNav of the DatePicker class (line 801) from:
toCode:public void onKeyPress(ComponentEvent ce) { // space bar pressed if (ce.getKeyCode() == 32) { selectToday(); } }
- GXT versionCode:public void onKeyPress(ComponentEvent ce) { // space bar pressed if (ce.getKeyCode() == 32) { ce.stopEvent(); selectToday(); } }
GXT 2.2.5 - GWT 2.4.0
- Host mode / web mode / both
Both modes
- Browser and version
IE 8, Firefox 9.0.1, Chrome 17.0.963.12 (dev), Opera 11.60
- Operating System
Windows XP SP3
-
4 Jan 2012 7:51 AM #2
The correct solution would be
Code:Index: user/src/com/extjs/gxt/ui/client/widget/DatePicker.java=================================================================== --- user/src/com/extjs/gxt/ui/client/widget/DatePicker.java (revision 2473) +++ user/src/com/extjs/gxt/ui/client/widget/DatePicker.java (working copy) @@ -791,6 +791,7 @@ public void onKeyPress(ComponentEvent ce) { // space bar pressed if (ce.getKeyCode() == 32) { + ce.preventDefault(); selectToday(); } }
-
4 Jan 2012 10:10 AM #3
Nice,
I used stopEvent() because I watched onKeyLeft() method.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote