wirtsi
16 Jan 2012, 8:00 AM
Hi ...
sorry, stupid title but this is what I'm currently trying to grasp.
I want to use Ext4 as the backend for various db tables. Ext doesn't know about the associated models, stores and grid columns but should first read these informations from the server and after that get the data in a second request.
Of course I could use a JSON request and extract the meta from there but I thought I use the new class loader system. So what I did ...
Ext.Loader.setPath('Cake','/www/admin');
Ext.syncRequire('Cake.contents.setup');
So here I tell Ext to load the meta data from the server. The server replies with something like this
Ext.define('M.model.Content', {
extend: 'Ext.data.Model',
fields: [
...
],
proxy: {
type: 'ajax',
url: Ext.WEBROOT_DIR+'js/ext/app/data/songs.json',
reader: {
type: 'json',
root: 'picturegalleries'
}
}
});
Ext.define('M.store.Contents', {
extend: 'Ext.data.Store',
model: 'M.model.Content',
autoLoad: true
});
Now the tricky part: Why doesn't this work
Ext.create('M.view.FactoryPanel',{
store: 'M.store.Contents',
title: 'Mhhhh',
columns: ...
but this works
Ext.create('M.view.FactoryPanel',{
store: Ext.create('M.store.Contents'),
title: 'Mhhhh',
Apparently I don't need to create my model but the store won't work without it. On the other hand I can define require: ['M.store.content'] in any view and ext manages to instantiate this store automatically.
Does anyone have any better idea on how to archieve dynamic metadata?
Thanks a lot in advance!
wirtsi
sorry, stupid title but this is what I'm currently trying to grasp.
I want to use Ext4 as the backend for various db tables. Ext doesn't know about the associated models, stores and grid columns but should first read these informations from the server and after that get the data in a second request.
Of course I could use a JSON request and extract the meta from there but I thought I use the new class loader system. So what I did ...
Ext.Loader.setPath('Cake','/www/admin');
Ext.syncRequire('Cake.contents.setup');
So here I tell Ext to load the meta data from the server. The server replies with something like this
Ext.define('M.model.Content', {
extend: 'Ext.data.Model',
fields: [
...
],
proxy: {
type: 'ajax',
url: Ext.WEBROOT_DIR+'js/ext/app/data/songs.json',
reader: {
type: 'json',
root: 'picturegalleries'
}
}
});
Ext.define('M.store.Contents', {
extend: 'Ext.data.Store',
model: 'M.model.Content',
autoLoad: true
});
Now the tricky part: Why doesn't this work
Ext.create('M.view.FactoryPanel',{
store: 'M.store.Contents',
title: 'Mhhhh',
columns: ...
but this works
Ext.create('M.view.FactoryPanel',{
store: Ext.create('M.store.Contents'),
title: 'Mhhhh',
Apparently I don't need to create my model but the store won't work without it. On the other hand I can define require: ['M.store.content'] in any view and ext manages to instantiate this store automatically.
Does anyone have any better idea on how to archieve dynamic metadata?
Thanks a lot in advance!
wirtsi