当前位置:首页 > 开发 > Web前端 > Ext > 正文

ext grid HttpProxy store servlet分页

发表于: 2010-12-04   作者:爪哇岛岛主   来源:转载   浏览:
摘要: 我直接上代码了 Ext.onReady(function(){ //定义列模型 var cm = new Ext.grid.ColumnModel([ {header:'编号',width:50,dataIndex:'Id'}, {header:'姓名',width:80,dataIndex:'Name',tooltip:'这是你的姓名'}, {header
我直接上代码了
Ext.onReady(function(){

	//定义列模型
	var cm = new Ext.grid.ColumnModel([
		{header:'编号',width:50,dataIndex:'Id'},
		{header:'姓名',width:80,dataIndex:'Name',tooltip:'这是你的姓名'},
		{header:'性别',width:40,dataIndex:'Sex',align:'center'},
		{header:'学历',width:80,dataIndex:'Education',align:'center'},
		{id:'memo',header:'备注',dataIndex:'Memo'}
	]);
	
	
	
	//proxy
	var proxy = new Ext.data.HttpProxy({url:"servlet/PageServlet",method:'post'});
	
	//record
	var human = Ext.data.Record.create([
		{name:'Id',type:'string',mapping:'hid'},
		{name:'Name',type:'string',mapping:'name'},
		{name:'Sex',type:'string',mapping:'sex'},
		{name:'Education',type:'string',mapping:'edu'},
		{name:'Memo',type:'string',mapping:'memo'}
	]);
	
	//reader
	var reader = new Ext.data.JsonReader({totalProperty:'totalProperty',root:'root'},human);
	//store
	var store = new Ext.data.Store({
		proxy:proxy,
		reader:reader
	});
	store.load({params:{start:0,limit:6}});
	var grid = new Ext.grid.GridPanel({
		title:'中国公民',
		width:600,
		collapsible:true,
		autoHeight:true,


cm:cm,
store: store,
renderTo:'mydiv',
autoExpandColumn:'memo',
buttonAlign:'center',
loadMask: {msg:'正在加载数据,请稍侯……'}, 
bbar:new Ext.PagingToolbar({
store:store,
pageSize:6,
displayInfo:true,
buttons:[
{text:'隐藏摘要'},
{text:'菜单',menu:new Ext.menu.Menu({items:[{text:'菜单项一'},{text:'菜单项二'}]})}
]
})
});

});



<%@ page language="java"  pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%
String path = request.getContextPath();
%>

<html>
	<head>
		<title>ext-02</title>
		<link rel="stylesheet" type="text/css" href="css/css/ext-all.css"/>
		<!-- <link rel="stylesheet" type="text/css" href="css/css/xtheme-access.css"/>
		 -->
		<link rel="stylesheet" type="text/css" href="css/lala.css"/>
		<script type="text/javascript" src="js/ext-base.js"></script>
		<script type="text/javascript" src="js/ext-all.js"></script>
		<script type="text/javascript" src="js/ext-lang-zh_CN.js"></script>
		<script type="text/javascript" src="js/grid.js"></script>
	</head>
	
	<body>
	
		<div id="mydiv"></div>
		
	</body>
</html>

ext grid HttpProxy store servlet分页

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号