1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    9
    Answers
    2
    Vote Rating
    0
    bsausser is on a distinguished road

      0  

    Default Answered: Simple MVC, data.Store, load function returns all parameters undefined

    Answered: Simple MVC, data.Store, load function returns all parameters undefined


    2 Days trying to follow the guides and examples...

    index.html
    Code:
    ...
            <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
            <script type="text/javascript" src="extjs/ext-debug.js"></script>
            <script type="text/javascript" src="app.js"></script>
    ...
    app.js
    Code:
    Ext.application({
        name: 'Ms2',
        
        controllers: ['Main'],
    
    
        autoCreateViewport: true,
    
    
        launch: function () {
            console.log('App lauch fired.');
        }
    });
    Main.js
    Code:
    Ext.define('Ms2.controller.Main', {
        extend: 'Ext.app.Controller',
    
    
        models: ['Ms2.model.MsListModel'],
    
    
        stores: ['Ms2.store.MsListStore'],
    
    
        init: function () {
            console.log('controller.Main initializing...');
        }
    });
    MsListModel.js
    Code:
    Ext.define('Ms2.model.MsListModel', {
        extend: 'Ext.data.Model',
    
    
        fields: [
            'Id',
            'Title',
            'ClientId',
            'ClientTitle',
            'SubmissionState',
            'CreatedDate'
        ]
    });
    MsListStore.js
    Code:
    Ext.define('Ms2.store.MsListStore', {
        extend: 'Ext.data.Store',
    
    
        model: 'Ms2.model.MsListModel',
    
    
        storeId: 'msListStore',
    
    
        autoLoad: true,
    
    
        proxy: {
            type: 'ajax',
            url: 'data/mslist.json',
            reader: {
                type: 'json',
                root: 'marketsubmissions',
                successProperty: 'success'
            }
        },
    
    
        load: function (me, records, successfull, opts) {
            console.log('MsListStore load fired.');
            console.log('MsListStore successfull: ' + successfull);
            console.log('records: ' + records.length);
        }
    });
    Chrome's console output:
    controller.Main initializing... /app/controller/Main.js?_dc=1342646382836:9
    Viewport initComponent fired. /app/view/Viewport.js?_dc=1342646382836:6
    App lauch fired. app.js:9
    MsListStore load fired. /app/store/MsListStore.js?_dc=1342646382872:21
    MsListStore successfull: undefined /app/store/MsListStore.js?_dc=1342646382872:22
    [COLOR=red !important]Uncaught TypeError: Cannot read property 'length' of undefined /app/store/MsListStore.js?_dc=1342646382872:23[/COLOR]





    Running on IIS 7.5; I have also verified that the url is correct and will render JSON

    Not sure what I am missing or not doing...Can somebody give me some direction?
    Brian

  2. Your data store should probably look like this:

    Code:
    Ext.define('Ms2.store.MsListStore', {
        extend: 'Ext.data.Store',
    
    
        model: 'Ms2.model.MsListModel',
    
    
        storeId: 'msListStore',
    
    
        autoLoad: true,
    
    
        proxy: {
            type: 'ajax',
            url: 'data/mslist.json',
            reader: {
                type: 'json',
                root: 'marketsubmissions',
                successProperty: 'success'
            }
        },
    
        listeners: {
          load: function (me, records, successfull, opts) {
            console.log('MsListStore load fired.');
            console.log('MsListStore successfull: ' + successfull);
            console.log('records: ' + records.length);
          }
        }
    });

  3. #2
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106
    Vote Rating
    27
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    Your data store should probably look like this:

    Code:
    Ext.define('Ms2.store.MsListStore', {
        extend: 'Ext.data.Store',
    
    
        model: 'Ms2.model.MsListModel',
    
    
        storeId: 'msListStore',
    
    
        autoLoad: true,
    
    
        proxy: {
            type: 'ajax',
            url: 'data/mslist.json',
            reader: {
                type: 'json',
                root: 'marketsubmissions',
                successProperty: 'success'
            }
        },
    
        listeners: {
          load: function (me, records, successfull, opts) {
            console.log('MsListStore load fired.');
            console.log('MsListStore successfull: ' + successfull);
            console.log('records: ' + records.length);
          }
        }
    });

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    9
    Answers
    2
    Vote Rating
    0
    bsausser is on a distinguished road

      0  

    Default ... and the url was incorrect ...

    ... and the url was incorrect ...


    Thanks for the help, as it turns out with the listeners properly implemented the url required the 'app' folder.

    My touch experience is making this more difficult I think.

    Brian

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi