You found a bug! We've classified it as EXTJS-5865 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
    Webtel is on a distinguished road

      0  

    Exclamation how to clear timefield list selection on field reset?

    how to clear timefield list selection on field reset?


    How can i clear selection from timefield drop down list on field reset or value being set?

    1. If i once pick any item it stays (visibly) selected event after reset or setting field value.

    2. clicking on that phantom selected item results in no action (it cant be selected even if field real value is null);

    Code:
    Ext.create('Ext.Window',{
        autoShow:true, width:200, autoDestroy:true, layout:'anchor',
        items:[
    
        	{xtype:'timefield'},
    
    
        	{xtype:'button',text:'reset',handler:function(){
        		this.previousSibling().reset();
        	}}
        ]
    });
    tested under chrome on extjs 4.0 (http://docs.sencha.com/ext-js/4-0/)

    PS. I guess it is a bug but i need answer rather than "new verion will be fixed" message.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    846
    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


    I am opening a bug report for this. If you need a work around, I would invite you to open a ticket at http://support.sencha.com/
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Code:
    Ext.create('Ext.Window',{
        autoShow:true, width:200, autoDestroy:true, layout:'anchor',
        items:[
    
        	{xtype:'timefield', autoSelect: false},
    
    
        	{xtype:'button',text:'reset',handler:function(){
        		this.previousSibling().reset();
        	}}
        ]
    });

  4. #4
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
    Webtel is on a distinguished road

      0  

    Default


    @mitchellsimoens - thank You.

    @Animal- sadly that didnt change anything. The problem is, as i tried to explain, that after selecting an item and reseting field, previous value is still (visibly) set on the dropdown list AND it cant be selected again (until some other item is selected first).

  5. #5
    Sencha User
    Join Date
    Apr 2011
    Posts
    1
    Vote Rating
    0
    P.Ersts is on a distinguished road

      0  

    Default


    I got around this by clearing the selection model. There is probably a much better way, but this what I came up with after fighting with this for a couple days.

    Code:
    Ext.override(Ext.form.field.Time, {
      reset: function() {
        this.callParent();
        this.applyEmptyText();
        this.getPicker().getSelectionModel().suspendEvents(false);
        this.getPicker().getSelectionModel().deselectAll(true);
        this.getPicker().getSelectionModel().resumeEvents();
      }
    });
    So far I have not noticed any unexpected side effect.

  6. #6
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
    Webtel is on a distinguished road

      0  

    Default


    Thanks a lot Mr Ersts. Thats good enough for me. I ll use it in the project..

    However there is still one small glitch. After reset previously selected item is still marked as selected but now this marking disapears on list mouseon and it can be easily selected again. case closed.

    PS1. This will surely be sufficient until 4.1 release.
    PS2. I' d marki it as a best answer but the thread was moved from questions to bugs.
    PS3. Congratulations! - Your first post and straightaway most helpful. cheers!

  7. #7
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Quote Originally Posted by Animal View Post
    Code:
    Ext.create('Ext.Window',{
        autoShow:true, width:200, autoDestroy:true, layout:'anchor',
        items:[
    
        	{xtype:'timefield', autoSelect: false},
    
    
        	{xtype:'button',text:'reset',handler:function(){
        		this.previousSibling().reset();
        	}}
        ]
    });
    Setting autoSelect to false stops that bad behaviour.