html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>03.grid</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css">
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>
<script type="text/javascript">
Ext.BLANK_IMAGE_URL='ext/resources/image/default/s.gif';
Ext.onReady(function(){
var cm = new Ext.grid.ColumnModel([
{header:'编号',dataIndex:'id',sortable:true},
{header:'名称',dataIndex:'name',sortable:true},
{header:'描述',dataIndex:'descn',sortable:true}
]);
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'09_02_01.jsp'}),
reader: new Ext.data.JsonReader({
totalProperty: 'totalProperty',
root: 'root'
}, [
{name: 'id'},
{name: 'name'},
{name: 'descn'}
]),
remoteSort: true
});
var grid = new Ext.grid.GridPanel({
renderTo: 'grid',
autoHeight: true,
store: store,
cm: cm,
bbar: new Ext.PagingToolbar({
pageSize: 3,
store: store,
displayInfo: true,
displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
emptyMsg: "没有记录"
})
});
store.load({params:{start:0,limit:3}});
});
</script>
</head>
<body>
<div id="grid" style="height:265px;"></div>
</body>
</html>
jsp
<%
String start = request.getParameter("start");
String limit = request.getParameter("limit");
try{
int index=Integer.parseInt(start);
int pageSize=Integer.parseInt(limit);
String json = "{totalProperty:100,root:[
{id:0,name:'name0',descn:'descn0'},
{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'}
]}";
response.getWriter().write(json);
} catch(Exception ex) {
}
%>
});
没有数据为空的 为什么呢
<!--StartFragment -->