<script type="text/javascript">
Ext.onReady(function(){
var record = new Ext.data.Record.create([
{name: 'name',mapping:'name',type:'string'},
{name: 'sex',mapping:'sex',type:'string'},
{name: 'age',mapping:'age',type:'int'}
]);
var _store=new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url:"http://localhost:8080/EXT/ExtTree.jsp"
}),
reader: new Ext.data.JsonReader({
root:'results',
successProperty: true
},record),
remoteSort: true
});
_store.load();
var grid=new Ext.grid.GridPanel({
renderTo:Ext.getBody(),
width:500,
height:300,
frame:true,
title:'grid面板',
enableColumnHide:false,
store: _store,
colModel:new Ext.grid.ColumnModel([{
header:'姓名',
align:'center',
width: 150,
sortable: true,
menuDisable:true
},{
header:'性别',
align:'center',
dataIndex:'sex',
width: 150,
sortable: true,
menuDisable:true
},{
header:'年龄',
align:'center',
dataIndex:'age',
width: 150,
sortable: true,
menuDisable:true
}])
});
});
</script>
数据格式为{results:[{name:'木,sex:'男',age:'21'},{name:'方夏',sex:'男',age:'10'}]}
------解决方案--------------------
你试下 把数据格式变成
{"results":[{"name":"木","sex":"男","age":"21"},{"name":"方夏","sex":"男","age":"10"}]}