52,797
社区成员
发帖
与我相关
我的任务
分享
var propertyStore = new Ext.data.JsonStore({
autoLoad:true,//自动加载数据
url:'http://127.0.0.1:8080/pm/staff/staff!detail.action',
root:'props',
fields:['staffName','deptName'],
listeners: {
load:{
fn:function(store ,records,options) {
//获取propety grid组件
var propGrid = Ext.getCmp('propGrid');
//保证property grid是存在的
if(propGrid) {
//获得property grid的store数据
propGrid.setSource(store.getAt(0).data);
}
}
}
}
});
});
public static String getStaffDetail(List<Staff> staff) { //这里staff的长度为1,因为只有一个实体
String s = null;
Map<String ,Object> map = new HashMap<String ,Object>();
map.put("props", staff);
s = new JSONArray().fromObject(map).toString();
s = s.substring(1,s.length()-1);
return s;
}
{"props":[{"deptName":"A","staffName":"B"}]}
{"props":[{"部门名称":"A","姓名":"B"}]}
fields:['部门名称','姓名'],
{"props":[{"deptName":"A","staffName":"B"}]}
fields:['deptName','staffName'],