extjs win的复用

functionwin(id)
{
//下边函数体中的id相关可以换成变量控制了
vargrid =newExt.grid.GridPanel({
id :'Regionxxgrid',
ds : ds_Regionxx,
cm : cm_Regionxx,
sm :newExt.grid.CheckboxSelectionModel({
dataIndex :"id"
}),
height : 210,
viewConfig : {
forceFit :true
},
autoScroll :true,
frame :true,
listeners : {
rowdblclick :function()
{
varRegionxm = Ext.getCmp("Regionxxgrid").getSelectionModel()
.getSelected().get("FRegionName");
if(Regionxm.length > 0)
{
AddPublishForm.getForm().findField("qiyundi_add")
.setValue(Regionxm);
Regionxxwin.hide();
}
else
{
alert("无效的记录");
}
}
}
})
varwin = {
//....其他属性略
items : [grid]
}
returnnewExt.Window(win);
}
 
 
RegionxxFn =function() {
varRegionxxwin =newExt.Window({
title:"区域选择窗口",
width: 400,
height: 300,
plain:true,
resizable:false,
defaultType:"textfield",
labelWidth: 10,
hideAction:'hide',
closeAction:'hide',
closable:false,
modal:'true',
buttonAlign:"right",
items: [newExt.form.FormPanel({
labelWidth: 65,
labelAlign:'left',
align:'center',
frame:true,
items: [
{
layout:'column',
items:
[
newExt.grid.GridPanel({
id:'Regionxxgrid',
ds: ds_Regionxx,
cm: cm_Regionxx,
sm:newExt.grid.CheckboxSelectionModel({ dataIndex:"id"}),
height: 210,
viewConfig: {
forceFit:true
},
autoScroll:true,
frame:true,
listeners: { rowdblclick:function() {varRegionxm = Ext.getCmp("Regionxxgrid").getSelectionModel().getSelected().get("FRegionName");if(Regionxm.length > 0) { AddPublishForm.getForm().findField("qiyundi_add").setValue(Regionxm); Regionxxwin.hide(); }else{ alert("无效的记录"); } } }
})
]
}]
})],
tbar: [newExt.Toolbar.Fill(),'助记码', { id:'Regionzjm', xtype:'textfield', width: 80, listeners: {'change':function(val) { Ext.getCmp("Regionxmcx").focus(true,true); } } },'区域', { id:'Regionxmcx', xtype:'textfield', width: 80, listeners: { specialkey:function(f, e) {if(e.getKey() == e.ENTER) { SearchRegionxx(); } } } },
{ text:"查 询", handler:function() { SearchRegionxx(); } }, { text:'退 出', id:'close', handler:function() { Regionxxwin.hide(); } }
],
bbar:newExt.PagingToolbar({
store: ds_Regionxx,
pageSize: 10,
displayInfo:true,
displayMsg:'当前{0}--{1} 条 共{2}条',
emptyMsg:"No results to display",
prevText:"上一页",
nextText:"下一页",
refreshText:"刷新",
lastText:"最后页",
firstText:"第一页",
beforePageText:"当前页",
afterPageText:"共{0}页"
})
});
Regionxxwin.show();
}
2
3
4
5
6
7
8
9
10
onTriggerClick:function(e) { RegionxxFn(1); }//起运站
onTriggerClick:function(e) { RegionxxFn(2); }//到站
RegionxxFn =function(o) {
if(o==1){
win('qiyunzhan').show();
}else{
win('daozhan').show();
}
}
 

你可能感兴趣的:(extjs win的复用)