extjs中的数据为什么在页面上展示不出来? 5
服务器端的代码:publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)throwsS...
服务器端的代码:
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
System.out.println("into deviceMaintenanceRecord...");
DeviceMaintenanceRecordsBiz dmrBiz=new DeviceMaintenanceRecordsBizImpl();
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
//获取封装好的json数据
String json=dmrBiz.getDeviceMaintenceRecords();
System.out.println("getJson:"+json);
response.getWriter().print(json);
}
服务器端成功生成的json格式的数据:
json={totalProperty:0,root:[{faultDescription:'aa',recordHuman:'dd'}]};
javascript语句:
Ext.onReady(function(){
var fields = ["faultDescription","recordHuman"];
var data = {total:100,xx:[{
faultDescription:"aa",
recordHuman:"aa"
},{
faultDescription:"bb",
recordHuman:"bb"
},{
faultDescription:"cc",
recordHuman:"cc"
}
]};
var record = Ext.data.Record.create([
// 下面的 "name" 匹配读到的标签名称, 除了 "birthDay",它被映射到标签 "birth"
{name: 'faultDescription', type: 'string' },
{name: 'recordHuman', type: 'string' }
]);
//var json={totalProperty:0,root:[{faultDescription:'aa',recordHuman:'dd'}]};
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'http://localhost:8080/wwtp/DeviceMaintenanceRecord'}), //分页代码
reader: new Ext.data.JsonReader(
{
totalProperty: 'totalProperty',
root: 'root'
},
record),
remoteSort: true
});
var cm = new Ext.grid.ColumnModel([{
header:"故障描述",
dataIndex:"faultDescription"
},{
header:"记录人员",
dataIndex:"recordHuman"
}
]);
var grid = new Ext.grid.GridPanel({
title:"grid列表显示示例",
width:600,
height:500,
cm:cm,
store:store
});
grid.render(Ext.getBody());
}); 展开
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
System.out.println("into deviceMaintenanceRecord...");
DeviceMaintenanceRecordsBiz dmrBiz=new DeviceMaintenanceRecordsBizImpl();
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
//获取封装好的json数据
String json=dmrBiz.getDeviceMaintenceRecords();
System.out.println("getJson:"+json);
response.getWriter().print(json);
}
服务器端成功生成的json格式的数据:
json={totalProperty:0,root:[{faultDescription:'aa',recordHuman:'dd'}]};
javascript语句:
Ext.onReady(function(){
var fields = ["faultDescription","recordHuman"];
var data = {total:100,xx:[{
faultDescription:"aa",
recordHuman:"aa"
},{
faultDescription:"bb",
recordHuman:"bb"
},{
faultDescription:"cc",
recordHuman:"cc"
}
]};
var record = Ext.data.Record.create([
// 下面的 "name" 匹配读到的标签名称, 除了 "birthDay",它被映射到标签 "birth"
{name: 'faultDescription', type: 'string' },
{name: 'recordHuman', type: 'string' }
]);
//var json={totalProperty:0,root:[{faultDescription:'aa',recordHuman:'dd'}]};
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'http://localhost:8080/wwtp/DeviceMaintenanceRecord'}), //分页代码
reader: new Ext.data.JsonReader(
{
totalProperty: 'totalProperty',
root: 'root'
},
record),
remoteSort: true
});
var cm = new Ext.grid.ColumnModel([{
header:"故障描述",
dataIndex:"faultDescription"
},{
header:"记录人员",
dataIndex:"recordHuman"
}
]);
var grid = new Ext.grid.GridPanel({
title:"grid列表显示示例",
width:600,
height:500,
cm:cm,
store:store
});
grid.render(Ext.getBody());
}); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询