This issue has been fixed for the next release!
  1. #1
    Sencha User cyberwombat's Avatar
    Join Date
    Oct 2011
    Posts
    237
    Vote Rating
    2
    cyberwombat is on a distinguished road

      0  

    Default Model.load() broken in PR4 - fix provided

    Model.load() broken in PR4 - fix provided


    REQUIRED INFORMATION
    Ext version tested:
    • ST2 PR4
    Browser versions tested against:
    • Chrome current
    DOCTYPE tested against:
    • html
    Description:
    • Calling the Ext.data.Model.load() method gives an error about model not found
    Steps to reproduce the problem:
    • Run doc example for Model:
    The result that was expected:
    • No errors and my model should return my new record/call proxy if needed
    The result that occurs instead:
    Code:
    Uncaught Error: [ERROR][Ext.data.Operation#setModel] An Operation needs to have a model defined
    Test Case:
    Code:
    MyApp.User = Ext.define('User', {
        extend: 'Ext.data.Model',
        fields: [
            {name: 'id', type: 'int'},
            {name: 'name', type: 'string'}
        ]
    });
    
    
    MyApp.User.load(10, {
        scope: this,
        failure: function(record, operation) {
            //do something if the load failed
        },
        success: function(record, operation) {
            //do something if the load succeeded
        },
        callback: function(record, operation) {
            //do something whether the load succeeded or failed
        }
    });
    Fix:
    Ext.data.Model.load() needs to pass the model the operation
    Code:
    Ext.define('Ext.data.Model', {
    ...
    load: function(id, config) {
                config = Ext.apply({}, config);
                config = Ext.applyIf(config, {
                    model: this,   //this line is necessary
                    action: 'read',
                    params: {
                        id: id
                    }
                });

  2. #2
    Sencha - Sencha Touch Dev Team Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    21
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    This is an issue that is fixed in the next release. Thank you for the override though

    Sencha Inc

    Jamie Avins

    @jamieavins

Thread Participants: 1