REQUIRED INFORMATION
Ext version tested:
  • Sencha Touch 2.0.0-pr2
Browser versions tested against:
  • Chrome
DOCTYPE tested against:
  • html (5)
Description:
  • When instantiating a DirectStore a type error is thrown missing the method 'copyTo'
  • Uncaught TypeError: Object #<Object> has no method 'copyTo'
    • Ext.define.constructor sencha-touch-all-debug-w-comments.js:41189
    • Ext.apply.create.Class sencha-touch-all-debug-w-comments.js:4971
    • (anonymous function) stores.js:34
Steps to reproduce the problem:
  • Instantiate a direct store
The result that was expected:
  • A direct store will be created.
The result that occurs instead:
  • An exception is thrown.
Test Case:
Code:
  
var directUserStore = new Ext.data.DirectStore({
        paramsAsHash: true,
        root: 'records',
        directFn: gameService.getUsers,
        autoLoad: true,
        fields: ['id', 
                 'name'
                 ]
      });
HELPFUL INFORMATION
Adding the copyTo method out of Ext 4 solves the problem.
Code:
Ext.copyTo = function(dest, source, names, usePrototypeKeys){
    if(typeof names == 'string'){
        names = names.split(/[,;\s]/);
    }
    Ext.each(names, function(name){
        if(usePrototypeKeys || source.hasOwnProperty(name)){
            dest[name] = source[name];
        }
    }, this);
    return dest;
}
Possible fix:
  • Add the copyTo method to the Ext static definition.
Additional CSS used:
  • only default ext-all.css
Operating System:
  • Mac OSX 10.7