解析数据有问题,请参考官方写法var Employee = Ext.data.Record.create([ {name: 'firstname'}, // 映射了Record的"firstname" 字段为行对象的同名键名称 map the Record's "firstname" field to the row object's key of the same name {name: 'job', mapping: 'occupation'} // 映射了"job"字段为行对象的"occupation"键 map the Record's "job" field to the row object's "occupation" key ]); var myReader = new Ext.data.JsonReader( { // metadata元数据属性,有以下的属性:The metadata property, with configuration options: totalProperty: "results", // 该属性是指定记录集的总数(可选的)the property which contains the total dataset size (optional) root: "rows", // 该属性是指定包含所有行对象的数组the property which contains an Array of row objects idProperty: "id" // 该属性是指定每一个行对象中究竟哪一个是记录的ID字段(可选的)the property within each row object that provides an ID for the record (optional) }, Employee // Ext.data.Record构造器是提供JSON对象的映射。Ext.data.Record constructor that provides mapping for JSON object );
{name: 'firstname'}, // 映射了Record的"firstname" 字段为行对象的同名键名称 map the Record's "firstname" field to the row object's key of the same name
{name: 'job', mapping: 'occupation'} // 映射了"job"字段为行对象的"occupation"键 map the Record's "job" field to the row object's "occupation" key
]);
var myReader = new Ext.data.JsonReader(
{ // metadata元数据属性,有以下的属性:The metadata property, with configuration options:
totalProperty: "results", // 该属性是指定记录集的总数(可选的)the property which contains the total dataset size (optional)
root: "rows", // 该属性是指定包含所有行对象的数组the property which contains an Array of row objects
idProperty: "id" // 该属性是指定每一个行对象中究竟哪一个是记录的ID字段(可选的)the property within each row object that provides an ID for the record (optional)
},
Employee // Ext.data.Record构造器是提供JSON对象的映射。Ext.data.Record constructor that provides mapping for JSON object
);