You found a bug! We've classified it as TOUCH-3967 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    74
    Vote Rating
    4
    zwikske is on a distinguished road

      0  

    Default Datepicker doesn't set a correct value

    Datepicker doesn't set a correct value


    REQUIRED INFORMATIONExt version tested:
    • Sencha Touch 2.1
    Browser versions tested against:
    • Chrome 24.0.1312.57 m
    Description:
    • When setting a value in the picker of a Ext.field.DatePicker only _value seems to get set. When retrieving the value using getValue() in either DatePicker or the picker, always a date will be returned.
    Steps to reproduce the problem:
    • set a non-date value in the picker
    • retrieve the value from either datepicker or picker
    The result that was expected:The result that occurs instead:
    • a date returns
    Test Case:I've added a button in the 'picker' example. The below code is just a button in either the getPhoneItems() or getTabletItems().
    Code:
    {
        text: 'Clear',
        scope: this,
        handler: function()
        {
            console.log(this.picker.getValue());
            this.picker.setValue(new Date());
            console.log(this.picker.getValue());
            this.picker.setValue(null);
            console.log(this.picker.getValue());
            this.picker.setValue(undefined);
            console.log(this.picker.getValue());
            this.picker.setValue('');
            console.log(this.picker.getValue());
        }
    },
    HELPFUL INFORMATION
    Screenshot or Video:
    Screenshot: http://imgur.com/ZH3LLWi

    Debugging already done:
    • The only thing I could find is that _value does get set, but getValue seems to retrieve something else.
    Possible fix:
    • not provided
    Operating System:
    • Windowns 7 Pro

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,015
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha Premium Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    74
    Vote Rating
    4
    zwikske is on a distinguished road

      0  

    Default


    Thanks for adding this to the bug tracker. Will I be informed when there's an updated regarding this bug?

    As a workaround you can use the following work-around
    Code:
    handler: function(button)
    {
        var picker = button.up('datepicker');
        picker.clearMarker = true;
        picker.fireEvent('change', picker, null);
        picker.hide();
    }
    Note that I've added a marker.

    In your getValue() function you could use this:
    Code:
    if (this.getPicker().clearMarker && this._value === null)
    {
        return this._value;
    }

Thread Participants: 1