EXTJS4.0表单分页的错误
本帖最后由 lenj520 于 2013-09-03 16:13:43 编辑 JSON:
{totalProperty:59,
root:[
{"mms_create_time":null,"mms_moban_create_user":"","mms_moban_id":1,"mms_moban_name":"测试模板","mms_moban_type":""},
{"mms_create_time":null,"mms_moban_create_user":"","mms_moban_id":2,"mms_moban_name":"测试模板","mms_moban_type":""},
{"mms_create_time":null,"mms_moban_create_user":"","mms_moban_id":3,"mms_moban_name":"模板1","mms_moban_type":""},
{"mms_create_time":null,"mms_moban_create_user":"","mms_moban_id":4,"mms_moban_name":"模板测试","mms_moban_type":""},
{"mms_create_time":null,"mms_moban_create_user":"","mms_moban_id":5,"mms_moban_name":"测试模板","mms_moban_type":""},
{"mms_create_time":null,"mms_moban_create_user":"","mms_moban_id":6,"mms_moban_name":"圣诞快乐","mms_moban_type":""},
{"mms_create_time":null,"mms_moban_create_user":"","mms_moban_id":7,"mms_moban_name":"测试模板","mms_moban_type":""},
{"mms_create_time":null,"mms_moban_create_user":"","mms_moban_id":8,"mms_moban_name":"测试模板","mms_moban_type":""},
{"mms_create_time":null,"mms_moban_create_user":"","mms_moban_id":9,"mms_moban_name":"测试模板","mms_moban_type":""},
{"mms_create_time":null,"mms_moban_create_user":"","mms_moban_id":10,"mms_moban_name":"测试模板","mms_moban_type":""}]}
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="./ext-4.0/resources/css/ext-all.css" />
<script type="text/javascript" src="./ext-4.0/bootstrap.js"></script>
<script type="text/javascript" src="./ext-4.0/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var itemsPerPage = 10;//指定分页大小
var store = Ext.create('Ext.data.Store', {
autoLoad: {start: 0, limit: itemsPerPage},
fileds:['mms_create_time','mms_moban_create_user','mms_moban_id','mms_moban_name','mms_moban_type'],
pageSize: itemsPerPage, //设置分页大小
proxy : {
type: 'ajax',
url: './mmsTelate.action', //请求的服务器地址
reader: {
type:'json',
root:'root',
totalProperty:'totalProperty'
}
}
});
//创建Grid表格组件
Ext.create('Ext.grid.Panel',{
title : 'Ext.toolbar.Paging示例',
renderTo: Ext.getBody(),
width:650,
height:150,
frame:true,
store: store,
columns:[
{header:"时间",width:130,dataIndex:"mms_create_time",sortable:true},
{header:"创建人",width:130,dataIndex:"mms_moban_create_user",sortable:true},
{header:"编号",width:130,dataIndex:"mms_moban_id",sortable:true},
{header:"模板名称",width:130,dataIndex:"mms_moban_name",sortable:true},
{header:"模板类型",width:130,dataIndex:"mms_moban_type",sortable:true}
],
bbar: [{
xtype: 'pagingtoolbar',
store: store, //这里需要指定与表格相同的store
displayInfo: true
}]
});
});
</script>
</HEAD>
<BODY STYLE="margin: 10px"></BODY>
</HTML>