1. 程式人生 > >ExtJs寫本地ArrayStore,ComboBox調用

ExtJs寫本地ArrayStore,ComboBox調用

set spl 交互 com nbsp get item 設備 .json

//自定義國內、國外下拉框

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), //數據類型

relations: ["="].join(prj.colSplit), // ==> sfields[i]-relations[i]-store["cvalue"](該值從S_CUR_ID中取,從另一個方法中用getValue()取)==>sqleg:PO_RECEIPT_HDR.CUR_ID = ‘CNY‘
orders: ‘ order by PO_RECEIPT_HDR.RECEIPT_ID ‘
},
totalProperty: "totalCount"
});

ExtJs寫本地ArrayStore,ComboBox調用