Ext.data中常用的方法

1.主要由以下构成
a.DataProxy:子类--MermoryProxy,httpProxy,ScriptTagProxy
b.DataReader:定义数据结构  ArrayReader,XmlReader,JsonReader
c.Store

2.数据中记录的定义
a.record
Ext.data.Record.create(数组);
var PersonRecord=Ext.data.Record.create([{name:'name',type:'string'},{name:'sex',type:'int'}]);
var boy=new PersonRecord({name:'boy',sex:0})

b.store
var data = [['boy',0],['girl',1]];

var PersonRecord=Ext.data.Record.create([{name:'name',type:'string'},{name:'sex',type:'int'}]);
 var store = new Ext.data.Store({
 	proxy: new Ext.data.MemoryProxy(data),
 	reader: new Ext.data.ArrayReader({}, PersonRecord)
 });
store.load();
Ext.onReady(function(){
	alert(store.getAt(0).get('name'));
}

JsonStore=Store+HttpProxy+JsonReade
var ds=Ext.data.JsonStore({
          url:'xxx.jsp',
          root:'root',
          fields:['id','name','descn']
});

var jsonStore = new Ext.data.JsonStore({
	data:{'root':[{'name':'chen','age':'18'},{'name':'wang','age':'20'}]},
	root: 'root',
	fields:['name','age']
});

SimpleStore=Store+MemoryProxy+ArrayReader
var simpleStore = Ext.data.SimpleStore({
	data:[['girl','wang'],['boy','chen']],
	fields:['sex','name']
});

你可能感兴趣的:(Data)