我App.js的代碼在這裏:商店加載順序
Ext.Loader.setConfig({
enabled: true
});
Ext.application({
name: 'KP',
appFolder: 'scripts/app',
controllers: [
'MainSearch', 'List'
],
launch: function() {
Ext.create('Ext.container.Viewport', {
items: {
xtype: 'searchdata'
}
});
}
});
的問題是: 我有模式( '列表'),存儲( '列表'),視圖( '列表')和控制器('列表') - 所有這些都是我的網格。在商店('列表')我打電話給服務,這給了我一些數據。
我想在「MainSearch」表單後查看我的網格。所以,我首先調用了「MainSearch」。 (在App.js中)。但是,在我的瀏覽器中顯示「MainSearch」表單之前,「List」中的服務被調用。我不明白爲什麼會發生。 (當App.js不包括 '列表' 控制器 - 一切工作正常)
「列表」 的 '商店' 代碼:
Ext.define('KP.store.List', {
extend: 'Ext.data.Store',
model: 'KP.model.List',
autoLoad: true,
pageSize: 20,
autoLoad: { start: 0, limit: 20 },
autoSync: true,
proxy: {
type: 'ajax',
limitParam: 'size',
startParam: undefined,
api: {
read: '/adres/listls'
},
reader: {
type: 'json',
root: 'data',
successProperty: 'success',
totalProperty: 'total'
}
}
});
'列表' 控制器代碼:
Ext.define('KP.controller.List', {
extend: 'Ext.app.Controller',
views: ['personAccount.List'],
models: ['List'],
stores: ['List'],
init: function() {
this.control({
'list button[action=close]': {
click: this.closeClick
}
});
},
//закрытие формы
closeClick: function (button) {
var win = button.up('window');
win.close();
}
});
我的列表視圖代碼:
Ext.define('KP.view.personAccount.List', {
extend: 'Ext.window.Window',
alias: 'widget.list',
autoScroll: true,
modal: false,
plain: false,
autoShow: true,
layout: {
type: 'fit'
},
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [
{
xtype: 'gridpanel',
store: 'List',
forceFit: true,
columns: [
....
],
dockedItems: [
{
xtype: 'pagingtoolbar',
store: 'List',
dock: 'bottom',
displayInfo: true
}
]
}
]
});
me.callParent(arguments);
}
});
非常感謝!
這是不是很清楚你問什麼,你需要發佈更多的信息。 –
它一點也不清楚。 「這是問題」是最好的部分......哪個問題? – sra
可能是由於initComponent:function()在Vew「List」中? – Oleg