87,989
社区成员
发帖
与我相关
我的任务
分享var myData = Ext.define('MyData',{
extend: 'Ext.data.Model',
fields: [
{name:'carType',mapping:'carType',type:'string'},
{name:'plateColor',type:'string'},
{name:'plateNum',type:'string'}
]
});
var itemsPerPage = 25;
var storeData = Ext.create('Ext.data.Store', {
model: myData,
pageSize: itemsPerPage,
proxy: {
type: 'ajax',
url:'vehicleManage/queryVehicleInfo.action',
reader: {
type: 'json',
root: 'resultItems'
}
},
autoLoad: false,
listeners: {
load: function() {
storeData.each(function(record) {
alert(record.get("plateNum"));
});
}
}
});
storeData.load();
Ext.create('Ext.grid.Panel', {
title: '查询结果',
store: storeData,
columns: [
{header: '车辆类型', dataIndex: 'carType',align : 'center'},
{header: '车牌号码', dataIndex: 'plateNum',align : 'center'},
{header: '车辆颜色', dataIndex: 'plateColor',align : 'center'}
],
height: 200,
width: width,
renderTo: 'result'
});public String queryVehicleInfo() throws BusinessException,
IllegalAccessException, InvocationTargetException {
String jsonStr = "{\"resultItems\":[{\"carType\":\"1111\",\"plateColor\":\"111\",\"plateNum\":\"11111\"}]}";
System.out.println(jsonStr);
this.outString(jsonStr);
return SUCCESS;
}
public void outString(String str) {
try {
PrintWriter out = getResponse().getWriter();
out.write(str);
} catch (IOException localIOException) {
}
}