1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    19
    Vote Rating
    0
    Answers
    1
    wxkevin is on a distinguished road

      0  

    Default Answered: Is it possible to reload a form after saving?

    Answered: Is it possible to reload a form after saving?


    I am using Ext JS 4.1.0.

    I have a form where a user enters a name. After saving the server piece will look up additional information for the name provided and puts that into the model. I have tried many, many ways but I have been unable to get the new data reloaded into the form. The record that is passed into the success function after saving still has an id of 0 and not the "real" id that gets updated when sent to the server to be saved. Since the id is 0, I have no way of loading the record.

    How can this be done?

    Here is some code that does not work:
    Code:
    ...
    buttons: [{
       text: 'Save',
       handler: function() {
          var form = this.up('form').getForm();
          var record = form.getRecord();
          if  (record) {
             form.updatedRecord(record);
             record.save({
                success: function(rec) {
                   var comp = Ext.ComponentQuery.query('myForm');
                   var form = comp[0].getForm();
                   form.loadRecord(rec);
                })
           }
      }
    .....

  2. Shouldn't be a reason why you couldn't do that.

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


    Shouldn't be a reason why you couldn't do that.
    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.

  4. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    19
    Vote Rating
    0
    Answers
    1
    wxkevin is on a distinguished road

      0  

    Default


    Yes you are correct. I figured out the problem. I wasn't returning the updated object from my Spring Controller. The above code is working correctly.

Thread Participants: 1

Tags for this Thread