0
我使用這篇文章架構http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/如何傳遞價值給其他商店
我有這樣的一個函數,其中我得到城市名
function resellerwindow(cityname) {
// render the grid to the specified div in the page
// resellergrid.render();
Application.ResellerGrid.cityname=cityname;
console.log(Application.ResellerGrid.cityname);
var win = new Ext.Window({
items:{xtype:'ResellerGrid'}
});
win.show();
}
這城市的名字我想傳遞給實體店這裏的resellergrid是我的resellergrid類。
Application.ResellerGrid = Ext.extend(Ext.grid.GridPanel, {
border:false
,cityname : ''
,initComponent:function() {
var config = {
store:new Ext.data.JsonStore({
// store configs
autoDestroy: true,
autoLoad :true,
url: 'api/index.php?_command=getresellers&city='+this.cityname,
storeId: 'getresellerscount',
// reader configs
root: 'reseller',
idProperty: 'firstname',
fields: [
{name: 'firstname'},
{name: 'lastname'},
{name: 'mobile'},
{name: 'email'},
{name: 'tmecode'},
{name: 'tmename'},
{name: 'updatedon'},
{name: 'apptype'},
{name: 'alloctype'},
{name: 'empparent'},
{name: 'irodeferred'}
]
})
,columns: [
{
id :'firstname',
header : 'First Name',
width : 120,
sortable : true,
dataIndex: 'firstname'
},
{
id :'lastname',
header : ' Last Name',
width : 100,
sortable : true,
dataIndex: 'lastname'
},
{
id :'mobile',
header : 'Mobile',
height : 50,
width : 100,
sortable : true,
dataIndex: 'mobile'
},
{
id :'email',
header : 'E-Mail',
width : 100,
sortable : true,
dataIndex: 'email'
},
{
id :'tmecode',
header : ' TME Code',
width : 100,
sortable : true,
dataIndex : 'tmecode'
},
{
id :'updatedon',
header : ' updatedon',
width : 100,
sortable : true,
dataIndex: 'updatedon'
},
{
id :'empparent',
header : ' empparent',
width : 100,
sortable : true,
dataIndex: 'empparent'
}
]
,plugins :[]
,viewConfig :{forceFit:true}
,tbar :[]
,bbar :[]
,height : 250
,width : 860
,title : 'Reseller Grid'
}; // eo config object
// apply config
Ext.apply(this, Ext.apply(this.initialConfig, config));
Application.ResellerGrid.superclass.initComponent.apply(this, arguments);
} // eo function initComponent
,onRender:function() {
// this.store.load();
Application.ResellerGrid.superclass.onRender.apply(this, arguments);
} // eo function onRender
});
Ext.reg('ResellerGrid', Application.ResellerGrid);
如何傳遞城市名稱的API我試圖通過在ResellerGrid類的屬性城市名,並在功能設置,但它沒有工作,那麼如何將工作,這是非常重要的