Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-1987 in a recent build.
  1. #1
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    22
    Vote Rating
    0
    mom_pece is on a distinguished road

      0  

    Default Model.Save scope

    Model.Save scope


    Save method for Model is documented having one parameter (Options) where you should be able to set the scope. Looking in the source code, the Save method of Model is in fact taking two parameters, second one being scope.

    save
    : function(options, scope)

    One of them source or documentation is wrong.

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


    This is changing the scope for me in beta2:

    Code:
    Ext.define('Test', {
        extend : 'Ext.data.Model',
    
        config : {
            fields : ['test'],
            proxy  : {
                type   : 'ajax',
                url    : 'data/json.json',
                reader : 'json'
            }
        }
    });
    
    var me = this;
    
    Ext.application({
        name: 'Test',
    
        launch: function() {
            var model = new Test({
                test : 'Hi'
            });
    
            model.save(function() {
                console.log(this);
            }, me);
        }
    });
    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
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    22
    Vote Rating
    0
    mom_pece is on a distinguished road

      0  

    Default


    I know it does, only that the documentation for model.save says:

    save( Object options ) : Ext.data.Model
    Saves the model instance using the configured proxy.

    You just called model.save(object, scope) instead, with two parameters. I use the same workaround but I don;t think is consistent. I think scope should be a member of options object {scope: this, callback:...}

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,522
    Vote Rating
    814
    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


    Ah! I see! We will get the documentation to match the source.
    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.

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    9
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    Updated, thanks!

Thread Participants: 2

Tags for this Thread