日期:2014-05-16  浏览次数:20388 次

ExtJs3.4项目应用备忘--PAJZ12sub.jsp
<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@page import="java.net.URLDecoder;" %>
<html>
<head>

		<title>采样审核信息</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<style type='text/css'>
			#tit_tag{
				font-size:85%;
			
			}
		</style>
		<script type="text/javascript" src="../css/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="../css/jquery.PrintArea.js"></script>
		
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/extjs/resources/css/ext-all.css" />
		<script type="text/javascript" src="<%=request.getContextPath()%>/extjs/adapter/ext/ext-base.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath()%>/extjs/ext-all.js"></script>
	    <script type="text/javascript" src="<%=request.getContextPath()%>/extjs/ext-lang-zh_CN.js" charset="utf-8"></script>
		<script>  
			$(document).ready(function(){   
				$("input#biuuu_button").click(function(){   
					$("div#myPrintArea").printArea();
				});   
			}); 
			Ext.onReady(function(){

			// 获得父窗口的对象   
		   var parentwin = window.dialogArguments;   
		   var jhVal = parentwin.document.getElementById("jh").value; //井号
		   var cwVal = parentwin.document.getElementById("cw").value; //层位
		   var checkedVal = parentwin.document.getElementById("chkedId").value;//分析项目 
		   
			//列定义
		    var cm = new Ext.grid.ColumnModel([
		        new Ext.grid.RowNumberer(),//生成编号
		        {header:'<center>课题名称</center>', dataIndex:'KTMC', width:150},
		        {header:'<center>采样单位</center>', dataIndex:'CYDW', width:100},
		        {header:'<center>采样负责人</center>', dataIndex:'CYFZR',width:50},
		        {header:'<center>采样日期</center>', dataIndex:'CYRQ',width:100,sortable:true},
		        {header:'<center>联系电话</center>', dataIndex:'LXDH',width:100,align:'right'},
		        {header:'<center>归档位置</center>',dataIndex:'GDWZ',width:150}
		    ]);
		    
		    //数据源
			var store = new Ext.data.Store({
				//参数
				baseParams: {flg:'getCheckedYPXXBInfo',jh:jhVal,cw:cwVal,checkedItem:checkedVal}, 
				//代理
		        proxy: new Ext.data.HttpProxy({
		        	url:'<%=request.getContextPath()%>/pajz12Servlet', method:'post'
		        }),
		        //数据格式
		        reader: new Ext.data.JsonReader({
		            totalProperty: 'totalProperty',
		            root: 'root'
		        },[
		            {name: 'KTMC'},
		            {name: 'CYDW'},
		            {name: 'CYFZR'},
		            {name: 'CYRQ'},
		            {name: 'LXDH'},
		            {name: 'GDWZ'}
		        ])
	    	});
	    	
	    	////////创建表格对象
		    var grid = new Ext.grid.GridPanel({
		        width: Ext.get("grid").getWidth(), //指定表格的宽度为div的宽度
				height: Ext.get("grid").getHeight(), //指定表格的宽度为div的高度
		        renderTo: 'grid',
		        store: store,
		        cm: cm,
		        //添加分页控件
		        bbar: new Ext.PagingToolbar({
		            pageSize: 15,//页面容量
		            store: store,//数据源
		            displayInfo: true,//显示消息
		            displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条记录',//有数据时的消息
		            emptyMsg: "没有记录"//无数据的消息
		        }),
		        viewConfig:{
		        	forceFit:true
		        }
		    });
		    
		  store.load({params:{start:0,limit:15}});
});
		</script>  
	
</head>
<body align="center">
		<div id="print" style="text-align:right;width:90%;"><input id="biuuu_button" type="button" value="打印" ></input> </div>
		<div id="myPrintArea" style="width:1000px;height:90%;">
			<fieldset>
				<legend id="tit_tag">打印区域</legend>
				<div id="grid" style="width:100%;height:380px;"></div>
			</fieldset>