1. #1
    Ext JS Premium Member firejack's Avatar
    Join Date
    Apr 2007
    Location
    Baltimore, MD
    Posts
    22
    Vote Rating
    0
    firejack is on a distinguished road

      0  

    Default [CLOSED] GXT 1.1.2: DateField does not fire Change Event

    [CLOSED] GXT 1.1.2: DateField does not fire Change Event


    I am finding that DateField objects do not seem to fire change events when they are updated. I am trying to use change listeners to keep field values in sync with model values in a uniform way, but DateFields don't seem to want to cooperate.

    Here is a simple example.

    FormPanel fp = new FormPanel();
    final DateField df = new DateField();

    df.addListener(Events.Change, new Listener() {

    public void handleEvent(FieldEvent p_event)
    {
    MessageBox.alert("Date Field Changed", df.getValue(), null);
    }

    });

    The change event never fires when I render this guy. In addition, I have tried firing the change event myself from the setValue() method, but that seems to wreak havoc with the widget a bit. Not sure why, but I am looking at the internals now.

  2. #2
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    Please post complete test code when submitting a bug as it make it much easier to replicate the issue.

    For example:

    Code:
      public void onModuleLoad() {
        FormPanel fp = new FormPanel();
        DateField df = new DateField();
        df.addListener(Events.Change, new Listener<FieldEvent>() {
          public void handleEvent(FieldEvent p_event) {
            Window.alert("change: " + p_event.value);
          }
        });
        fp.add(df);
        RootPanel.get().add(fp);
      }
    The change events fires when the field is blurred, not when the user selects a value from the date picker. I did find a bug. In some browsers, if you did not put focus on the text field before clicking the trigger the change event did not fire. This is fixed in SVN.

  3. #3
    Ext JS Premium Member firejack's Avatar
    Join Date
    Apr 2007
    Location
    Baltimore, MD
    Posts
    22
    Vote Rating
    0
    firejack is on a distinguished road

      0  

    Default Code Examples will do...

    Code Examples will do...


    Darrell -

    No problem on the code examples. Thanks a ton for getting those fixes in. This one and the resize issue fixed me right up. Much appreciated.

  4. #4
    Ext User
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    12
    Vote Rating
    0
    FrankCA is on a distinguished road

      0  

    Default


    but what about if you want the event to fire on change (that is once user has clicked a date on the datepicker) and you DO NOT want to have to wait for blur to occur ????

  5. #5
    Ext User
    Join Date
    Apr 2010
    Posts
    2
    Vote Rating
    0
    bimjulien is on a distinguished road

      0  

    Default


    There is a solution :
    Code:
            DateField startDate = new DateField();
            startDate.getDatePicker().addListener(Events.Select, new Listener<DatePickerEvent>() {
    
                public void handleEvent(DatePickerEvent be) {
                    // TODO Auto-generated method stub
                    //On Select event :)
                }
                
            });

  6. #6
    Sencha User
    Join Date
    Aug 2011
    Posts
    1
    Vote Rating
    0
    benpage26 is on a distinguished road

      0  

    Default Is it possible to auto-blur the DateField when the picker fires a selected event?

    Is it possible to auto-blur the DateField when the picker fires a selected event?


    Is it possible to auto-blur the DateField when the picker fires a selected event?

    I can only find a way to focus another field, but it would be best if the field could be de-focused automatically.
    This would allow the change event to fire, and also stop users accidentally typing in the field once they have selected a date.