網上看到的一個事例
Ext
var dtCategory=[
[
[
[
[
[
[
[
[
[
];
var stCategory=new Ext
fields:[
data:dtCategory
});
var cbCategory=new Ext
id:"cbCategory"
store:stCategory
displayField:"text"
valueField:"value"
typeAhead:true
mode:"local"
triggerAction:"all"
emptyText:"請選擇商品種類
editable:false
allowBlank:false
blankText:"商品種類必須選擇"
autoSelect:true
selectOnFoucus:true
value:
dfval:
});
cbCategory
var tfName=new Ext
id:
});
var btnSearch=new Ext
id:
iconCls:
text:
handler:function(){
stProduct
}
});
var btnHelp=new Ext
text:
iconCls:
})
var tb=new Ext
id:
items:[
cbCategory
tfName
btnSearch
btnHelp
]
});
var pnNorth=new Ext
id:
region:
autoHeight:true
items:[
tb
]
});
var url="Default
var stProduct=new Ext
id:"st"
proxy:new Ext
reader:new Ext
});
stProduct
var cmProduct=new Ext
new Ext
{header:"產品名稱"
{header:"產品種類"
{header:"單價"
{header:"是否停產"
{header:"規格"
{header:"供貨商"
]);
var pgtbProduct=new Ext
id:"pgtbProduct"
displayInfo:true
emptyMsg:"沒有數據要顯示!"
displayMsg:"當前為第{
store:stProduct
pageSize:
});
var grdProduct=new Ext
id:"grdProduct"
title:"商品信息"
cm:cmProduct
store:stProduct
autoWidth:true
selModel:new Ext
height: screen
frame: true
pageSize:
bbar:pgtbProduct
//autoExpandColumn:
loadMask:true
viewConfig:{
forceFit:true
}
});
var stSupplier = new Ext
id: "stSupplier"
autoLoad:true
proxy: new Ext
reader: new Ext
});
var pnProduct=new Ext
id:
title:
autoHeight:true
items:[
new Ext
id:
border:false
bodyStyle:
layout:
items:[
new Ext
columnWidth:
border:false
layout:
labelWidth:
labelAlign:
items:[
{
xtype:
id:
name:
fieldLabel:
anchor:
}
]
})
new Ext
columnWidth:
border:false
layout:
labelWidth:
labelAlign:
items:[
{
xtype:
id:
//hiddenName:
name:
inputValue:
fieldLabel:
boxLabel:
anchor:
}
]
})
new Ext
columnWidth:
border:false
layout:
labelWidth:
labelAlign:
items:[
{
xtype:
id:
//hiddenName:
name:
checked:true
inputValue:
boxLabel:
anchor:
}
]
})
]
})
new Ext
id:
border:false
layout:
items:[
new Ext
columnWidth:
border:false
layout:
labelWidth:
labelAlign:
items:[
{
xtype:
id:
name:
fieldLabel:
anchor:
}
]
})
new Ext
columnWidth:
border:false
layout:
labelWidth:
labelAlign:
items:[
{
xtype:
id:
name:
fieldLabel:
anchor:
}
]
})
]
})
new Ext
id:
border:false
layout:
items:[
new Ext
columnWidth:
border:false
layout:
labelWidth:
labelAlign:
items:[
{
xtype:
id:
name:
fieldLabel:
anchor:
}
]
})
new Ext
columnWidth:
border:false
layout:
labelWidth:
labelAlign:
items:[
{
xtype:
id:
//name:
hiddenName:
fieldLabel:
displayField:
valueField:
mode:
typeAhead: true
triggerAction: "all"
editable: false
allowBlank: false
autoSelect: true
selectOnFoucus: true
store: stSupplier
anchor:
}
]
})
]
})
]
});
var pnCategory=new Ext
id:
title:
autoHeight:true
items:[
new Ext
id:
border:false
bodyStyle:
layout:
items:[
new Ext
columnWidth:
border:false
layout:
labelWidth:
labelAlign:
items:[
{
xtype:
id:
name:
fieldLabel:
anchor:
}
{
xtype:
id:
name:
fieldLabel:
anchor:
}
{
xtype:
id:
name:
fieldLabel:
}
]
})
new Ext
columnWidth:
border:false
bodyStyle:
layout:
labelWidth:
labelAlign:
items:[
{
xtype:
id:
width:
height:
autoEl:{
tag:
src:
}
}
]
})
]
})
]
});
var tpProduct=new Ext
id:
deferredRender:false
layoutOnTabChange:true
//height:
//autoTabs:true
activeTab:
border:false
items:[
pnProduct
pnCategory
]
});
var fpProduct=new Ext
id:
reader: new Ext
successProperty:
root:
}
[
//
]
)
items:[
tpProduct
]
});
var winProductInfo=new Ext
title:
width:
height:
layout:
closeAction:
plain:true
collapsible:true
modal:true
items:[
fpProduct
]
buttons:[//窗體按鈕
{
text:
handler:function(){
if(fpProduct
var record=grdProduct
fpProduct
method:
url:
waitMsg:
success:function(){
stProduct
Ext
}
failure:function(){
Ext
}
});
}
}
}
{
text:
handler:function(){//點擊時觸發的事件
winProductInfo
}
}
]
});
// Ext
// Ext
// });
grdProduct
var row=grid
//Ext
fpProduct
url:
waitMsg:
success:function(){
//alert("tempFile/"+row
if(row
Ext
}else{
Ext
}
Ext
}
failure:function(){
Ext
}
});
winProductInfo
});
var pnCenter=new Ext
id:
region:
items:[
grdProduct
]
});
var vp=new Ext
id:
layout:
renderTo:Ext
items:[
pnNorth
pnCenter
]
});
});
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19963.html