Results 1 to 7 of 7

Thread: how to clear timefield list selection on field reset?

    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
      0  

    Exclamation 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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,029
    Vote Rating
    1368
      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 @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,761
    Vote Rating
    83
      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();
        	}}
        ]
    });
    Longtime Sencha engineer. Now surplus to requirements apparently...

  4. #4
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
      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
      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
      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 User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,761
    Vote Rating
    83
      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.
    Longtime Sencha engineer. Now surplus to requirements apparently...

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
  •