extjs显示数据的问题
@RequestMapping(value="/getdata",method = RequestMethod.POST)
public JSONArray getdata(ModelMap model,Tydsz query,HttpServletRequest request,HttpServletResponse response) throws Exception {
List<Tydsz> ydsz=tydszSV.findAll();
JSONArray data=net.sf.json.JSONArray.fromObject(ydsz);
return data;
}
var contactStore = new Ext.data.Store({
url: './object/xml.do?otype=limitedPartner&action=view&id='+viewId,//从后端获取xml数据
reader:new Ext.data.XmlReader({
record:'contact',//从xml中的contact节点中读取数据
fields:new Ext.data.Record.create([
{name:'id',mapping:'@id',type:'string'},//读取contact节点中的id属性
{name:'name',mapping:'@name',type:'string'},
{name:'gender',mapping:'@gender',type:'string'},
{name:'title',mapping:'@title',type:'string'},
{name:'phone',mapping:'@phone',type:'string'},
{name:'birthday',mapping:'@birthday',type:'string'},
{name:'reminder',mapping:'@reminder',type:'string'}
])
})
});
var grid = new Ext.grid.GridPanel({
id:'contactGrid',
store:contactStore,
height:220,
width:'100%',
stripeRows:true,
cm:new Ext.grid.ColumnModel({
columns:[
new Ext.grid.RowNumberer(),
{header: '姓名', dataIndex: 'name'},//定义姓名列,展示contactStore中缓存的name数据
{header: '性别', dataIndex: 'gender',renderer:genderRenderer},
{header: '职称', dataIndex: 'title'},
{header: '手机', dataIndex: 'phone'},
{header: '出生年月', dataIndex: 'birthday'},
{header: '生日提醒', dataIndex: 'renminder',renderer:remindRenderer}
],
defaults:{
width: 20
}
}),
view:new Ext.grid.GridView({
columnsText: '筛选列',
sortAscText: '升序',
sortDescText: '降序',
forceFit:true
})
});
<xml>
<contact id="" name="" gender=""></contact>
</xml>