Reputation: 2063
In my application i got e.g. two Models like this:
Ext.define('App.model.Translation', {
extend: 'App.model.MRModel',
requires: 'App.model.TranslationItem',
fields: [
...
],...
and
Ext.define('App.model.administration.Station', {
extend: 'App.model.MRModel',
requires: [
'App.model.Translation',
'App.classes.proxy.ProxyNegotiator'
],
fields: [
...
],...
and in my Model Station i want to add a field with the default value of a new Translation like this:
Ext.define('App.model.administration.Station', {
extend: 'App.model.MRModel',
requires: [
'App.model.Translation',
'App.classes.proxy.ProxyNegotiator'
],
fields: [
{ name: 'Id', type: 'int', convert: null },
{
name: 'Name',
type: 'auto',
convert: function(value) {
...
},
defaultValue: new App.model.Translation()
},
though when i am inserting this line with the default Value i get the following error: Uncaught TypeError: undefined is not a function
It seems that the Translation class is not loaded jet.. I dont understnand this cuz i added the class to the requires array...
Please help.
Upvotes: 0
Views: 5386
Reputation: 19945
The defaultValue
is a string or the object that should be the default value.
The problem is that new App.model.Translation()
probably does not return what you need. It should return an empty string or 0 or something similar (just a plain simple default value for the Name).
If you want to translate, you should use the config convert
like
convert: function(value) {
App.model.Translation.translate(value)
},
Upvotes: 1