View Full Version : Dynamic loading of dynamic grid data

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 ...


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

store: 'M.store.Contents',
title: 'Mhhhh',
columns: ...

but this works

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!


16 Jan 2012, 11:00 AM
if you assign store with a string value it will look it up in the StoreManager, the string is the id of the store, it will not assume the string is the class name.

17 Jan 2012, 12:18 AM
Ok, that makes sense ... thanks :)