ExtJs寫本地ArrayStore,ComboBox調用
//自定義國內、國外下拉框
var sCurStore = new Ext.data.ArrayStore({ //設備狀態store
fields: ["ckey", "cvalue"],
data: [[‘CNY‘, "國內"], [‘USD‘, "國外"]], //取data值
id: "ckey",
toValue: function (v) {
if (v) {
var rec = sCurStore.query("ckey", v, true, true).items[0];
return rec ? rec.data.cvalue : v;
}
});
//ComBox調用
var S_CUR_ID = new ef.ComboBox({
name: ‘myname‘,
hiddenName: ‘myhiddenName‘,
store: sCurStore, //調用stroe
displayField: ‘cvalue‘,
valueField: ‘ckey‘,
mode: ‘local‘,
triggerAction: ‘all‘,
width: 80
})
//JSON前後臺交互
var p_store = new Ext.data.JsonStore({ //數據集
url: "URL", //後臺URL
fields: ["Settle_Amount_Domcur"], //查找數據庫值name
root: "data",
baseParams:{
page: "1",
sfields:[‘PO_RECEIPT_HDR.CUR_ID‘].join(prj.colSplit),//傳遞數據庫值name
sfieldtypes: [‘string‘].join(prj.colSplit), //數據類型
orders: ‘ order by PO_RECEIPT_HDR.RECEIPT_ID ‘
},
totalProperty: "totalCount"
});
ExtJs寫本地ArrayStore,ComboBox調用