1. #11
    Sencha User
    Join Date
    Aug 2009
    Posts
    480
    Vote Rating
    1
    plalx has a spectacular aura about plalx has a spectacular aura about

      0  

    Default


    When are you calling this line?

    this.details.getActiveTab().resetData();

  2. #12
    Sencha User
    Join Date
    Sep 2010
    Posts
    55
    Vote Rating
    1
    alberto01 is on a distinguished road

      0  

    Default


    mm little bit more complicated:...
    Inside the first panel i have a button:
    PHP Code:
    this.controlBar.getComponent('undoButton').addListener(
                
    "click", function(a,b) {
                    
    console.log('reset data');
                    
    this.details.getActiveTab().resetData();
                },
                
    this
            
    ); 
    After loading data I press the button and it clear all the fields...

    bye tnx

  3. #13
    Sencha User
    Join Date
    Sep 2010
    Posts
    55
    Vote Rating
    1
    alberto01 is on a distinguished road

      0  

    Default


    up plz

  4. #14
    Sencha User
    Join Date
    Aug 2009
    Posts
    480
    Vote Rating
    1
    plalx has a spectacular aura about plalx has a spectacular aura about

      0  

    Default


    Ok... and you said that this works?

    Code:
    store.on('load', function(){refToBasicForm.reset();});

  5. #15
    Sencha User
    Join Date
    Sep 2010
    Posts
    55
    Vote Rating
    1
    alberto01 is on a distinguished road

      0  

    Default


    mm not really
    I've tryed only this way:
    PHP Code:
    getData: function(anag_id){ 
            
    this.getForm().waitMsgTarget this.getEl(); 
            
    this.load({ 
                
    url'http://localhost/get.php'
                
    params: {'anag_id'anag_id}, 
                
    waitMsg 'Loading Data...' 
            
    }); 
    this.getForm().reset(); ///////////////////////////////////////////////////   this works
        
    }, 
    "This works" I mean that the form remains filled,
    so I think that the reset() is working as it should ...

    no?

  6. #16
    Sencha User darthwes's Avatar
    Join Date
    Mar 2010
    Posts
    633
    Vote Rating
    -11
    darthwes can only hope to improve

      0  

    Default


    Whoa. You can't reset the form after the call to load, load is asynchronous and non blocking. You should use the success or callback method inside load to reset the form. Your code is resetting the form but we don't know if the load has succeeded yet.
    Wes

  7. #17
    Sencha User
    Join Date
    Aug 2009
    Posts
    480
    Vote Rating
    1
    plalx has a spectacular aura about plalx has a spectacular aura about

      0  

    Default


    Ok, I think I found out why it's not working properly. Like the doc says:

    Note: If subclassing FormPanel, any configuration options for the BasicForm must be applied to the initialConfig property of the FormPanel. Applying BasicForm configuration settings to this will not affect the BasicForm's configuration.

    Since you might have more than one property to apply, I suggest you override the constructor as well.

    E.g.

    Code:
    MyForm = Ext.extend(Ext.FormPanel, {
      constructor: function(config) {
       config = config || {};
       
       //Apply default config
       Ext.applyIf(config, {
        trackResetOnLoad: true
       });
       
       //At constructor level, config options will get automatically added to 
       //the initialConfig property.
       MyForm.superclass.constructor.call(this, config);
      },
      initComponent: function() {
       .....
      }
     });

  8. #18
    Sencha User
    Join Date
    Sep 2010
    Posts
    55
    Vote Rating
    1
    alberto01 is on a distinguished road

      0  

    Default


    Great!
    It has worked correctly!
    I didn't think to check if the configuration had been applied correctly.

    thank u

  9. #19
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Why so much code?
    Code:
    Ext.form.BasicForm.prototype.trackResetOnLoad = true;

  10. #20
    Sencha User
    Join Date
    Aug 2009
    Posts
    480
    Vote Rating
    1
    plalx has a spectacular aura about plalx has a spectacular aura about

      0  

    Default


    Well, that would set true as default for all forms, if that's what you want, then Condor solution would be better.

Similar Threads

  1. Ext.BasicForm.reset dumps original values for hidden fields
    By wwarby in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 24 Nov 2009, 12:21 PM
  2. [SOLVED] Radio not reset to their default values
    By senacle in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 2 Jul 2009, 12:18 AM
  3. Replies: 2
    Last Post: 3 Oct 2008, 5:48 AM
  4. BasicForm.reset() does not clear fields?
    By dante in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 30 May 2008, 4:14 AM
  5. Form fields reset to default on submitting
    By LorenzoW in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 30 Apr 2007, 6:42 AM

Thread Participants: 4