ExtJs写本地ArrayStore,ComboBox调用
1.自定义本地ArrayStore
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; } } });
2.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 })
3.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" });