Results 1 to 3 of 3

Thread: DatePicker select Today with SpaceBar shortcut key inserts a space on the field

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    13
    Vote Rating
    0
      0  

    Exclamation 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:
    Code:
          public void onKeyPress(ComponentEvent ce) {
            // space bar pressed
            if (ce.getKeyCode() == 32) {
              selectToday();
            }
          }
    to
    Code:
          public void onKeyPress(ComponentEvent ce) {
            // space bar pressed
            if (ce.getKeyCode() == 32) {
              ce.stopEvent();
              selectToday();
            }
          }
    - GXT version
    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

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      0  

    Default

    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();
             }
           }

  3. #3
    Sencha User
    Join Date
    Mar 2010
    Posts
    13
    Vote Rating
    0
      0  

    Default

    Nice,
    I used stopEvent() because I watched onKeyLeft() method.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •