ExtJS -- 各种Store

//ArrayStore
store: new Ext.data.ArrayStore({			
			fields:[
			        'sexTypeid',
			        'sexTypename'
			],
			data:[["MAN","男"],["WOMEN","女"],["NONE","男女不限"]]
		})
//JsonStore
new 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']
});	
//Store
var 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);//可获取到后台返回的自定义属性
        }

你可能感兴趣的:(ExtJS)