1. #1
    Sencha Premium Member
    Join Date
    Jan 2009
    Posts
    25
    Answers
    2
    Vote Rating
    0
    wirtsi is on a distinguished road

      0  

    Question Answered: Dynamic loading of dynamic grid data

    Answered: Dynamic loading of dynamic grid data


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

    Code:
            
    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

    Code:
    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

    Code:
    Ext.create('M.view.FactoryPanel',{           
                store: 'M.store.Contents',
                title: 'Mhhhh',
                columns: ...
    but this works

    Code:
    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

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

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha Premium Member
    Join Date
    Jan 2009
    Posts
    25
    Answers
    2
    Vote Rating
    0
    wirtsi is on a distinguished road

      0  

    Default


    Ok, that makes sense ... thanks

Thread Participants: 1

Tags for this Thread