Reputation: 1855
models: ['Foo'],
...
onEvent: function(args) {
var foo = this.getFooModel().create(...);
console.log(foo);
console.log(foo.getName());
},
...
I'm getting an Object [object Object] has no method 'getName'
error. Using Chrome's inspector, I see that foo
has $className: 'App.model.Foo'
and modelName: 'App.model.Foo'
attached to foo
's __proto__
. Inspecting further down the prototype chain, the object with $className: 'Ext.Base'
indeed does not have a getName
method..
Am I missing something?
Doc's reference of Ext.data.Model.getName
: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Model-static-method-getName
Upvotes: 1
Views: 472
Reputation: 2584
It's a static method which can not be called on an instance of a model.
In your case, this.getFooModel().getName()
should give the class name.
Upvotes: 2