日期:2014-05-16  浏览次数:20494 次

extjs前台显示不了数据,后台可以显示,大家帮忙看看什么问题
数据如下:

{"root":[{"age":20,"birthday":"2012-02-22","demo":"备注信息哈0","name":"张0","sex":"男"},{"age":21,"birthday":"2012-02-22","demo":"备注信息哈1","name":"张1","sex":"男"},{"age":22,"birthday":"2012-02-22","demo":"备注信息哈2","name":"张2","sex":"男"},{"age":23,"birthday":"2012-02-22","demo":"备注信息哈3","name":"张3","sex":"女"},{"age":24,"birthday":"2012-02-22","demo":"备注信息哈4","name":"张4","sex":"女"},{"age":25,"birthday":"2012-02-22","demo":"备注信息哈5","name":"张5","sex":"女"},{"age":26,"birthday":"2012-02-22","demo":"备注信息哈6","name":"张6","sex":"女"},{"age":27,"birthday":"2012-02-22","demo":"备注信息哈7","name":"张7","sex":"女"},{"age":28,"birthday":"2012-02-22","demo":"备注信息哈8","name":"张8","sex":"男"},{"age":29,"birthday":"2012-02-22","demo":"备注信息哈9","name":"张9","sex":"男"},{"age":30,"birthday":"2012-02-22","demo":"备注信息哈10","name":"张10","sex":"女"},{"age":31,"birthday":"2012-02-22","demo":"备注信息哈11","name":"张11","sex":"男"},{"age":32,"birthday":"2012-02-22","demo":"备注信息哈12","name":"张12","sex":"男"},{"age":33,"birthday":"2012-02-22","demo":"备注信息哈13","name":"张13","sex":"男"},{"age":34,"birthday":"2012-02-22","demo":"备注信息哈14","name":"张14","sex":"女"}],"totalProperty":86}



Ext.onReady(function(){


var reader=new Ext.data.JsonReader({

 
  root: 'root',
  totalProperty: 'totalProperty',
  

  // the fields config option will internally create an Ext.data.Record
  // constructor that provides mapping for reading the record data objects
  fields: [
  {name: 'name', mapping: 'name'},
  {name: 'age', mapping: 'age', allowBlank: false},
{name: 'sex', mapping: 'sex'},
{name: 'birthday', mapping: 'birthday', type: 'date'},
{name: 'demo', mapping: 'demo'}
  ]
});


  var store=new Ext.data.JsonStore({
  root : 'list',
idProperty : 'name',
totalProperty:'totalProperty',
  url:"GetStudentData",
fields: [
{name: 'name',type:"string", mapping: 'name'},
{name: 'age', type:"int",mapping: 'age', allowBlank: false},
{name: 'sex',type:"string", mapping: 'sex'},
{name: 'birthday', mapping: 'birthday', type: 'date'},
{name: 'demo', type:"string",mapping: 'demo'}
]
  });
   
  store.load({params:{start:0,limit:15}});