Pedro Marques
Pedro Marques

Reputation: 135

Sencha touch 2 Can't load static data

I'm tring to load a static data in my list but when I declare in my app.js:

stores:['Search'],

i got this erro on Chorme:

Uncaught Error: [Ext.Loader] Failed loading '../touch/src/data/Search.js', please verify that the file exists

I dont know why chrome try to load a local file and them nothing works...

model/Search.js

Ext.define('bolao.model.Search', {
extend: 'Ext.data.Model',
config: {
    fields: [
        {name: 'firstName',  type: 'string'},
        {name: 'lastName',  type: 'string'}
    ]
}
});

store/Search.js

Ext.define('bolao.store.Search', {
extend: 'Ext.data.Search',
requires : [ 'bolao.model.Search' ],
config: {
     storeId : 'Search',
     model: 'bolao.model.Search',
    data:[
        { firstName: 'Tommy',   lastName: 'Maintz' },
        { firstName: 'Rob',     lastName: 'Dougan' },
        { firstName: 'Ed',      lastName: 'Avins' }     ]
}

});

my list:

xtype: 'list',
            ui: 'round',
            pinHeaders: false,
            itemTpl: '<div class="contact">{firstName} <strong>{lastName}</strong></div>',
            Store: 'Search',
            emptyText: '<div style="margin-top: 20px; text-align: center">No Matching Items</div>',
            disableSelection: true

Upvotes: 1

Views: 280

Answers (1)

Naresh Tank
Naresh Tank

Reputation: 1568

change your store like below

Ext.define('bolao.store.Search', {
extend: 'Ext.data.Store',
requires : [ 'bolao.model.Search' ],
config: {
     storeId : 'Search',
     model: 'bolao.model.Search',
    data:[
        { firstName: 'Tommy',   lastName: 'Maintz' },
        { firstName: 'Rob',     lastName: 'Dougan' },
        { firstName: 'Ed',      lastName: 'Avins' }     ]
}

});

Upvotes: 1

Related Questions