日期:2014-05-16 浏览次数:20426 次
<html>
<head>
<link rel="stylesheet" type="text/css" href="./ExtJS4/resources/css/ext-all.css" />
<script type="text/javascript" src="./ExtJS4/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var columns = [
{header:'编号',dataIndex:'id',sortable:true},
{header:'名称',dataIndex:'name',sortable:true},
{header:'描述',dataIndex:'descn',sortable:true}
];
var store = new Ext.data.Store({
proxy: {
type: 'ajax',
url: 'data.json',
reader: {
type: 'json',
root: 'root'
}
},
fields: [
{name: 'id'},
{name: 'name'},
{name: 'descn'}
]
});
var grid = new Ext.grid.GridPanel({
renderTo: 'grid',
store: store,
columns: columns
});
store.load();
});
</script>
</head>
<body>
<div id="grid"></div>
</body>
</html>
{root:[
????{id:1,name:'name1',descn:'descn1'},
????{id:2,name:'name2',descn:'descn2'},
????{id:3,name:'name3',descn:'descn3'},
????{id:4,name:'name4',descn:'descn4'},
????{id:5,name:'name5',descn:'descn5'},
????{id:6,name:'name6',descn:'descn6'},
????{id:7,name:'name7',descn:'descn7'},
????{id:8,name:'name8',descn:'descn8'},
????{id:9,name:'name9',descn:'descn9'},
????{id:10,name:'name10',descn:'descn10'}
]}