EasyUI 的Window窗口refresh方法
请教个问题,easyUI的window窗口有个refresh方法,作用是通过Ajax读取窗口内容,通过查看API。说明是刷新面板来装载远程数据。如果'href'属性有了新配置,它将重写旧的'href'属性。
代码示例:
// 打开面板且刷新其内容。 $('#pp').panel('open').panel('refresh'); // 刷新一个新的URL内容 $('#pp').panel('open').panel('refresh','new_content.php');
页面可以正常加载。但我在取值的时候就有问题。我通过多种方法拿不到文本框的值。
都拿不到值。请高人指点。怎么可以得到值
$("input[name='cardId']").val(); $("#cardId").val(); document.getElementById("cardId").value;
贴完整代码:
personalGig.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="/struts-tags" prefix="s"%> <%@ include file = "/pub/jsp/head.jsp" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>个人违规记录</title> <script type="text/javascript"> $(function(){ $("#eidtWindow").window("close"); $("#tt").datagrid({ url:'<s:url value="/findGigAllVG.action" />', type: "post", title:"个人违规记录", rownumbers: true, pagination: true, pageList: [10, 20, 50, 100], frozenColumns: [[ {field:'ck',checkbox:true}, {field: "pgNo", title: "序号", width: 70, align:"center", hidden: true}, {field: "cardId", title: "职工身份证", width: 130, align:"center"}, {field: "pername", title: "职工姓名", width: 100, align:"center"}, ]], columns: [[ {field: "voilationDate", title: "违规建立时间", width: 100, align:"center"<%--, formatter:function(value,data,index){ var JsonDateValue = new Date(value.time); var text = JsonDateValue.toLocaleString(); return text; }--%> }, {field: "repealDate", title: "违规撤销时间", width: 100, align:"center"}, {field: "unitname", title: "工作单位", width: 150, align:"center"}, {field: "accnum", title: "个人账号", width: 100, align:"center"}, {field: "pgType", title: "违规类型", width: 80, align:"center"}, {field: "money", title: "涉及金额", width: 80, align:"center"}, {field: "remark", title: "备注", width: 120, align:"center"}, {field: "status", title: "记录状态", width: 80, align:"center"} ]], toolbar:[{ text: "新增", iconCls: "icon-add", handler: function(){ $("#eidtWindow").window("open"); $("#eidtWindow").window("refresh", "editGig.jsp"); $("#eidtWindow").window({ minimizable: false, maximizable: false, draggable: false, resizable: false, inline: true }); } },"-",{ text: "修改", iconCls: "icon-edit", handler: function(){ } },"-",{ text: "删除", iconCls: "icon-remove", handler: function(){ } }] }); // 查询 $("#query").click(function(){ var cardId = $("#cardId").val(); var userName = $("#userName").val(); var unitAccnum = $("#unitAccnum").val(); var accnum = $("#accnum").val(); $("#tt").datagrid("reload", { 'personalGig.cardId': $.trim(cardId), 'personalGig.pername': $.trim(userName), 'personalGig.accnum': $.trim(accnum), 'personalGig.unitAccnum': $.trim(unitAccnum) }); }); }); </script> </head><body> <form action=""> <s:div> <s:div cssClass="easyui-panel" cssStyle="padding:10px;background:#fafafa;margin-bottom:5px;"> <table width="100%" height="30" style="padding-left:15px;"> <tr> <td> 身份证:<s:textfield name="cardId"/> 姓 名:<s:textfield name="userName" /> 违规建立时间:<input class="easyui-datebox" name="bathDate" style="width:125px"> </td> </tr> <tr> <td> 单位帐号:<s:textfield name="unitAccnum" /> 个人帐号:<s:textfield name="accnum" /> 违规撤消时间:<input name="repealTime" class="easyui-datebox" style="width:125px"> <a id="query" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</a> </td> </tr> </table> </s:div> <s:div id="tt"></s:div> <s:div id="eidtWindow" cssClass="easyui-window" title="新增" cssStyle="width:700px;height:450px;padding:10px;background:#fafafa;" /> </s:div> </form> </body> </html>
editGig.jsp
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%> <%@ taglib uri="/struts-tags" prefix="s"%> <%@ include file = "/pub/jsp/head.jsp" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GBK"> <title>编辑个人违规</title> <script type="text/javascript"> $(function(){ // 关闭窗体 $("#cancel").click(function(){ $("#cancel").window("close"); }); // 保存数据 $("#save").click(function(){ alert($("input[name='cardId']").val()); alert($("#cardId").val()); var cardId = $("input[name='cardId']").val(); var userName = $("input[name='userName']").val(); var createTime = $("input[name='createTime']").val(); var cancelTime = $("input[name='cancelTime']").val(); var unitAccnum = $("input[name='unitAccnum']").val(); var accnum = $("input[name='accnum']").val(); var ptype = $("input[name='ptype']").val(); var money = $("input[name='money']").val(); var mark = $("input[name='mark']").val(); $.messager.alert("参数提示", "unitAccnum: " + unitAccnum + " cardId:" + cardId + " pername: " + userName); var url = '<s:url value="/addGigVG.action" />'; sendHostPost(url, { "personalGig.cardId": $.trim(cardId), "personalGig.voilationDate": $.trim(createTime), "personalGig.repealDate": $.trim(cancelTime), "personalGig.pername": $.trim(userName), "personalGig.accnum": $.trim(accnum), "personalGig.unitAccnum": $.trim(unitAccnum), "personalGig.pgType": $.trim(ptype), "personalGig.money": $.trim(money), "personalGig.remark": $.trim(mark) }, function(total, rows, value, data){ }, function(code, mess){ $.messager.alert("" + mess); }); }); }); </script> <style type="text/css"> #edittab table { border-collapse:collapse; } #edittab td { height:25px; border:1px solid #87CEFA; word-break:break-all; word-wrap:break-word; } </style> </head> <body> <s:div id="p" cssClass="easyui-layout" title="My Panel" cssStyle="width:665px;height:343px;background:#fafafa;"> <s:div region="center" split="true" border="false" cssStyle="padding:10px;background:#fff;border:1px solid #ccc;"> <s:div cssStyle="padding-left:50px;"> 其中 <font color="red">*</font> 为必填项 </s:div> <table id="edittab" align="center" border="0" cellpadding="0" cellspacing="0" style="width: 580px;"> <tr> <td align="right">职工身份证号:</td> <td> <s:textfield name="cardId" cssClass="easyui-validatebox" data-options="required:true"/> </td> <td align="right">职工姓名:</td> <td> <s:textfield name="userName" cssClass="easyui-validatebox" data-options="required:true"/> </td> </tr> <tr> <td align="right">违规建立时间:</td> <td> <input name="createTime" type="text" class="easyui-datebox" required="required"></input> </td> <td align="right">违规撤销时间:</td> <td> <s:textfield name="cancelTime" cssClass="easyui-datebox" required="required"/> </td> <tr> <tr> <td align="right">单位账号:</td> <td> <s:textfield name="unitAccnum" cssClass="easyui-validatebox" data-options="required:true"/> </td> <td align="right">个人账号:</td> <td> <s:textfield name="accnum" cssClass="easyui-validatebox" data-options="required:true"/> </td> <tr> <tr> <td align="right">违规类型:</td> <td> <s:select name="ptype" list="#{'0':'0','1':'1','2':'2'}" cssClass="easyui-combobox" style="width:155px;"/> </td> <td align="right">涉及金额:</td> <td> <s:textfield name="money" cssClass="easyui-validatebox" data-options="required:true"/> </td> <tr> <tr> <td align="right">备注:</td> <td colspan="3"> <s:textarea name="mark" cols="53" rows="5"/> </td> <tr> </table> </s:div> </s:div> <s:div region="south" split="true" border="false" cssStyle="text-align:right;height:30px;line-height:30px;"> <a class="easyui-linkbutton" iconCls="icon-save" href="javascript:void(0)" id="save">保存</a> <a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" id="cancel">关闭</a> </s:div> </body> </html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
楼主问题解决没有??