PDA

View Full Version : MyApp.model.Foo missing from Ext.data.schema.Schema



djbushby
13 Jul 2019, 7:12 PM
MyApp.model.Foo missing from Ext.data.schema.Schema


https://docs.sencha.com/extjs/7.0.0/modern/Ext.data.schema.Schema.html
In the following code, "MyApp.model.Foo" has an entityName of "Foo" and the schema has a namespace (https://docs.sencha.com/extjs/7.0.0/modern/Ext.data.schema.Schema.html#cfg-namespace) of "MyApp.model".
If you use deeper nesting for entities, you may need to set the namespace (https://docs.sencha.com/extjs/7.0.0/modern/Ext.data.schema.Schema.html#cfg-namespace) config to account for this. For example:
Ext.define('MyApp.model.Base', {
extend: 'Ext.data.Model',

schema: {
namespace: 'MyApp.model'
}
});
Your derived classes now will generate proper default entityName values even if they have further namespaces. For example, "MyApp.model.foo.Thing" will produce "foo.Thing" as the entityName given the above as a base class.