运行我的应用程序时出现以下错误:[WARN] [UniSelect.view.ListeClient #applicationStore]无法找到指定的商店
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
}
]
}
});
主/ ListeClient.js
Ext.define('UniSelect.view.ListeClient', {
extend: 'Ext.List',
xtype: 'listeClient',
config: {
store: 'UniSelect',
title: 'Produits',
itemTpl: '{matriculeClient}'
}
});
商店/ 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"
}]
}
});
型号/ 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' }
]
}
});
我无法理解为什么SenchaTouch无法加载我的商店。在我以前的SenchTouch应用程序中,我使用了相同的应用程序结构。
任何人都可以帮助我吗?
谢谢:)
答案 0 :(得分:1)
您在商店中提供了storeId: 'listeClient'
,但您在list(ListeClient.js)中将storeId作为UniSelect
。
因此,在ListeClient.js
中将store: 'UniSelect',
更改为store: 'listeClient',
商店会获取商店实例或商店ID。