easyui datagrid 彈出視窗
阿新 • • 發佈:2019-02-12
我的主頁面,程式碼如下:
Javascript程式碼- //新增資料彈出視窗
- $(function(){
- addDataWin = $('#addData-window').window({
-
href:'${basePath}/page/marketPlat2/addData/addData.jsp?workId=${workId}year=${year}&month=${month} &quarter=${quarter}&businessType=${businessType}&type=${type}'
- title:'新增資料',
- left:'100px',
- top:'70px',
- closed: true,
- modal: false,
- cache: false,
- minimizable:false,
- maximizable:false,
- collapsible:false,
- shadow: false
- });
- //新增資料彈出視窗
- function addData(){
-
addDataWin.window('open');
- }
- }
- //這裡只插入了一個datagrid的部分程式碼,就是點選這個按鈕,就會新呼叫addData()方法;
- {
- id:'add',
- text:'新增',
- iconCls:'icon-add',
- handler:addData
- }
- //關閉彈出視窗
- function closeWin(myWin) {
- myWin.window('close');
- };
- <!-- 彈出視窗:新增資料 -->
-
<div id="addData-window" title
- </div>
效果圖為:
第一個彈出視窗程式碼為:
Html程式碼- <%@ page language="java" contentType="text/html; charset=utf-8"
- pageEncoding="utf-8"%>
- <%
- String path = request.getContextPath();
- String basePath = request.getScheme() + "://"
- + request.getServerName() + ":" + request.getServerPort()
- + path + "/";
- response.setHeader("Cache-Control", "no store");//HTTP 1.1
- response.setHeader("Pragma", "no store");//HTTP 1.0
- response.setDateHeader("Expires", 0);//在代理伺服器端防止緩衝
- request.setAttribute("workId", request.getParameter("workId"));//yearwork表中的
- request.setAttribute("year", request.getParameter("year"));//年
- request.setAttribute("month", request.getParameter("month"));//月
- request.setAttribute("querter", request.getParameter("quarter"));//季
- request.setAttribute("businessType", request.getParameter("businessType"));//任務型別 (周1 年3 季2 月0)
- request.setAttribute("type", request.getParameter("type"));
- %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <base href="<%=basePath%>">
- <title>新增資料</title>
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="cache-control" content="no-cache">
- <meta http-equiv="expires" content="0">
- <script type="text/javascript">
- $(function(){
- $('#btn-save,#btn-close-save,#serchCustomList,#seachProductList').linkbutton();
- customobjWin=$('#customobj-window').window({
- href:'${basePath}/page/marketPlat2/addData/seachCustomobj_list.jsp?',
- title:'選擇客戶單位',
- closed: true,
- minimizable:false,
- maximizable:false,
- collapsible:false,
- cache:false,
- shadow:false
- });
- productWin=$('#product-window').window({
- href:'${basePath}/page/marketPlat2/addData/seachProduct_list.jsp?&type=${type}',
- title:'選擇產品',
- closed: true,
- minimizable:false,
- collapsible:false,
- maximizable:false,
- cache:false,
- shadow:false
- });
- });
- //選擇客戶單位彈出視窗
- function seachCustomobj(){
- customobjWin.window('open');
- }
- //給客戶單位文字框和隱藏域賦值
- function setCustomobjName(customOBJ){
- $('#seachCustomobjId').val(customOBJ.customobjId);
- var s =$('#seachCustomobjId').val();
- $('#seachCustomobjName').val(customOBJ.customobjName);
- }
- //給產品文字框和隱藏域賦值
- function setProductName(productOBJ){
- $('#seachProductId').val(productOBJ.productId);
- $('#seachProductName').val(productOBJ.productName);
- }
- //關閉客戶單位彈出視窗
- function closeCustomWin(){
- customobjWin.window('close');
- }
- //關閉產品彈出視窗
- function closeProductWin(){
- productWin.window('close');
- }
- //選擇產品彈出視窗
- function seachProduct(){
- var customobjId = $('#seachCustomobjId').val();
- if(customobjId==""||customobjId==null){
- alert("請選擇客戶單位");
- return false;
- }else{
- productWin.window('open');
- }
- }
- </script>
- </head>
- <body>
- <div style="padding: 10px 10px 10px 10px;">
- <form method="poxt">
- <table >
- <tr>
- <td width="30%">請選擇客戶單位:</td>
- <td width="50%">
- <input type="hidden" id="seachCustomobjId" name="seachCustomobjId" />
- <input type="text" name="seachCustomobjName" id="seachCustomobjName" readonly="readonly" class="easyui-validatebox" required="true" missingMessage="請選擇客戶單位名稱" style="width:200px"></input>
- <td>
- <td width="20%"><a href="javascript:void(0)" onclick="seachCustomobj()" id="serchCustomList" icon="icon-search">選擇</a></td>
- </tr>
- <tr><td colspan="3"> </td></tr>
- <tr>
- <td>請選擇產品:</td>
- <td>
- <input type="hidden" id="seachProductId" name="seachProductId" />
- <input type="text" name="seachProductName" id="seachProductName" readonly="readonly" class="easyui-validatebox" required="true" missingMessage="請選擇產品名稱" style="width:200px"></input>
- <td>
- <td ><a href="javascript:void(0)" onclick="seachProduct()" id="seachProductList" icon="icon-search">選擇</a></td>
- </tr>
- </table>
- </form>
- </div>
- <div style="text-align: center; padding: 5px;">
- <a href="javascript:void(0)" onclick="saveAddData()" id="btn-save" icon="icon-save">儲存</a>
- <a href="javascript:void(0)" onclick="closeWin(addDataWin)" id="btn-close-save" icon="icon-cancel">取消</a>
- </div>
- </table>
- <!-- 2期新增資料功能之選擇客戶單位彈出視窗 -->
- <div id="customobj-window" class="earyui-window" title="選擇客戶單位" style="width: 550px; height: 350px; padding: 0px; background:#fafafa; ">
- <!-- 2期新增資料功能之選擇產口彈出視窗 -->
- <div id="product-window" class="earyui-window" title=