ExtJS -- 各种Store

来源:互联网 发布:中华小说网源码 编辑:程序博客网 时间:2024/06/05 12:39
//ArrayStorestore: new Ext.data.ArrayStore({fields:[        'sexTypeid',        'sexTypename'],data:[["MAN","男"],["WOMEN","女"],["NONE","男女不限"]]})//JsonStorenew Ext.data.JsonStore({root:'grid',url: 'getData.action',fields: ['id','name']});var store = new Ext.data.JsonStore({root : 'grid',proxy: new Ext.data.HttpProxy({             url : 'getBdsbcxData.action',            timeout: 120000         }),totalProperty: 'totalCount',//sortInfo : {field: "PXBM", direction: "ASC"},fields : ['SBMC','SSBDZMC','DYDJMC']});//Storevar store = new Ext.data.Store({proxy: new Ext.data.HttpProxy({             url : 'getSbjhtjMxb.action',            timeout: 12000         }),        reader : new App.JsonReader/*原为Ext.data.JsonReader*/({        root : 'grid'        },['id', 'zbid', 'dwdm', 'dwmc'])});/** * 扩展JsonReader,使store.reload(callback:function(){此处可获取自定义属性}) * @class App.JsonReader * @extends Ext.data.JsonReader */App.JsonReader = Ext.extend(Ext.data.JsonReader, {    read : function(response){          var json = response.responseText;          var o = Ext.decode(json);          this.responseText = json;//add by ljm           if(!o) {              throw {message: 'JsonReader.read: Json object not found'};          }          return this.readRecords(o);      }  });//App.JsonReader 是为了store.reload({params : {    bmStr : bmStr   },callback:function(r,options,success){    myMask.hide();              var resp = Ext.util.JSON.decode(store.reader.responseText);//可获取到后台返回的自定义属性        }

0 0
原创粉丝点击