Question

I get the following error when I run my application : [WARN][UniSelect.view.ListeClient#applyStore] The specified Store cannot be found

App.js

Ext.application({
name: 'UniSelect',

requires: [
    'Ext.MessageBox',
],

views: ['Main', 'ListeClient',],

model: [
        'ListeClient'
    ],  

store: ['ListeClient'],

controller: ['controleur'],

Main.js

Ext.define('UniSelect.view.Main', {
extend: 'Ext.tab.Panel',
xtype: 'main',
requires: [
    'Ext.TitleBar',
    'Ext.Video',
    'UniSelect.store.ListeClient',
],
config: {
    tabBarPosition: 'bottom',

    items: [
        {
            title: 'Welcome',
            iconCls: 'home',

            styleHtmlContent: true,
            scrollable: true,

            items: {
                docked: 'top',
                xtype: 'titlebar',
                title: 'Liste des clients corporatifs'
            },

            html: [
                "You've just generated a new Sencha Touch 2 project. What you're looking at right now is the ",
                "contents of <a target='_blank' href=\"app/view/Main.js\">app/view/Main.js</a> - edit that file ",
                "and refresh to change what's rendered here."
            ].join("")
        },
        {
            xtype: 'listeClient',
            store: 'listeClient',
            grouped: true

        }
    ]
}
});

Main/ListeClient.js

Ext.define('UniSelect.view.ListeClient', {
extend: 'Ext.List',
xtype: 'listeClient',

config: {

    store: 'UniSelect',

    title: 'Produits',

    itemTpl: '{matriculeClient}'

}


});

Store/ListeClient.js

Ext.define('UniSelect.store.ListeClient', {
extend : 'Ext.data.Store',

config : {
    storeId: 'listeClient',

    model : 'UniSelect.model.ListeClient',

    grouper : {
        sortProperty : 'prenomClient',
        groupFn : function(record) {
            return record.get('prenomClient').substring(0, 1);
        }
    },

    sorters : [ {
        property : 'prenomClient',
        direction : 'ASC'
    }, {
        property : 'nomClient',
        direction : 'ASC'
    } ],

    data : [ {
        "matriculeClient" : "c001",
        "prenomClient" : "Guy",
        "nomClient" : "Belanger",
        "nbJourRabais" : "7",
        "nbJourEcheance" : "17",
        "nbJourRetard" : "0"
    }, {
        "matriculeClient" : "c001",
        "prenomClient" : "Guy",
        "nomClient" : "Belanger",
        "nbJourRabais" : "7",
        "nbJourEcheance" : "17",
        "nbJourRetard" : "0"
    }, {
        "matriculeClient" : "c001",
        "prenomClient" : "Guy",
        "nomClient" : "Belanger",
        "nbJourRabais" : "7",
        "nbJourEcheance" : "17",
        "nbJourRetard" : "0"
    }, {
        "matriculeClient" : "c001",
        "prenomClient" : "Guy",
        "nomClient" : "Belanger",
        "nbJourRabais" : "7",
        "nbJourEcheance" : "17",
        "nbJourRetard" : "0"
    }, {
        "matriculeClient" : "c001",
        "prenomClient" : "Guy",
        "nomClient" : "Belanger",
        "nbJourRabais" : "7",
        "nbJourEcheance" : "17",
        "nbJourRetard" : "0"
    }, {
        "matriculeClient" : "c001",
        "prenomClient" : "Guy",
        "nomClient" : "Belanger",
        "nbJourRabais" : "7",
        "nbJourEcheance" : "17",
        "nbJourRetard" : "0"
    }]
}
});

Model/ListeClient.js

Ext.define('UniSelect.model.ListeClient', {
extend: 'Ext.data.Model',

config: {
    fields: [
        { name: 'matriculeClient', type: 'auto' },
        { name: 'prenomClient', type: 'auto' },
        { name: 'nomClient', type: 'auto' },
        { name: 'nbJourRabais', type: 'auto' },
        { name: 'nbJourEcheance', type: 'auto' },
        { name: 'nbJourRetard', type: 'auto' }

    ]
}
});

I just can't understand why SenchaTouch isn't able to load my store. In my previous SenchTouch application, I`ve used the same application structure.

Can anyone help me ?

Thank you :)

Was it helpful?

Solution

You gave storeId: 'listeClient' in store, but you gave storeId as UniSelect in list ( ListeClient.js).

So change store: 'UniSelect', to store: 'listeClient', in ListeClient.js

Store takes either a Store instance or a Store id.

see docs

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top