Ext.onReady(function() {
var jsonReader=new Ext.data.JsonReader({
root:'root',
totalProperty:'totalProperty'},
[{
name:"id",
mapping:"id"
},{
name:"name",
mapping:"name"
},{
name:"descn",
mapping:"descn"
}]
);
var dsjihui = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : 'barcode.jsp'
}),
reader : jsonReader
});
dsjihui.load();
var cm = new Ext.grid.ColumnModel([
{header:'编号',dataIndex:'id'},
{header:'名称',dataIndex:'name'},
{header:'描述',dataIndex:'descn'}
]);
var grid = new Ext.grid.GridPanel({
// autoHeight: true,
//autoWidth:true,
height: 200,
width: 400,
// renderTo: 'grid',
store: dsjihui,
cm: cm,
renderTo: 'grid'
// autoExpandColumn: 'descn'
});
});
后台打印出来的json数据是:
{"totalProperty":10,"root":[{"descn":"descn","name":"zackey","id":"000"},{"descn":"descn","name":"zackey","id":"001"},{"descn":"descn","name":"zackey","id":"002"},{"descn":"descn","name":"zackey","id":"003"},{"descn":"descn","name":"zackey","id":"004"},{"descn":"descn","name":"zackey","id":"005"},{"descn":"descn","name":"zackey","id":"006"},{"descn":"descn","name":"zackey","id":"007"},{"descn":"descn","name":"zackey","id":"008"},{"descn":"descn","name":"zackey","id":"009"}]}
请各位帮忙看看啊 我折腾两天了 还做不出来。