datagrid里的js这么写
//点击添加按钮触发
function superadd(title,addurl,gname,width,height) { gridname=gname; createwindow(title, addurl,width,height); }//点击修改按钮触发function superupdate(title,url, id,width,height,isRestful) { gridname=id; var rowsData = $(‘#‘+id).datagrid(‘getSelections‘); if (!rowsData || rowsData.length==0) { tip(‘请选择编辑项目‘); return; } if (rowsData.length>1) { tip(‘请选择一条记录再编辑‘); return; } if(isRestful!=‘undefined‘&&isRestful){ url += ‘/‘+rowsData[0].id; }else{ url += ‘&id=‘+rowsData[0].id; } createwindow(title,url,width,height);}//写一个ldhdialogfunction createwindow(title, addurl,width,height) { width = width?width:700; height = height?height:400; if(width=="100%" || height=="100%"){ width = window.top.document.body.offsetWidth; height =window.top.document.body.offsetHeight-100; } //--author:JueYue---------date:20140427---------for:弹出bug修改,设置了zindex()函数 if(typeof(windowapi) == ‘undefined‘){ $.dialog({ content: ‘url:‘+addurl, lock : true, //zIndex:1990, width:width, height:height, title:title, opacity : 0.3, cache:false, ok: function(){ iframe = this.iframe.contentWindow; saveObj(); return false; }, cancelVal: ‘关闭‘, cancel: true ,/*为true等价于function(){}*/ button:[{ name: ‘发起‘, focus: true, callback: function(){ iframe = this.iframe.contentWindow; faqi(); //调用这个方法 return false; } }] }).zindex(); }else{ W.$.dialog({ content: ‘url:‘+addurl, lock : true, width:width, //zIndex:1990, height:height, parent:windowapi, title:title, opacity : 0.3, cache:false, ok: function(){ iframe = this.iframe.contentWindow; saveObj(); return false; }, cancelVal: ‘关闭‘, cancel: true, /*为true等价于function(){}*/ buttons: [{ text: ‘Ok‘, iconCls: ‘icon-ok‘, handler: function () { alert(‘ok‘); } }, { text: ‘Cancel‘, iconCls: ‘icon-cancel‘, handler: function () { $(‘#dlg‘).dialog(‘close‘); } }] }).zindex(); }} function faqi() { $(‘#faqi‘, iframe.document).click(); //faqi 是个在添加和编辑页面的一个<a>的id;会触发编辑页面中的onclick() window.f_load();//刷新父页面datagrid}
function f_load(){ $(‘#tPdmisExceptionList‘).datagrid(‘reload‘);}
编辑页面jsp
<a class="easyui-linkbutton l-btn" id="faqi" onclick="faqi()">发起</a>
function faqi(){ $.ajax({ cache: true, type: "POST", url:‘tPdmisExceptionController.do?faqi‘, data:$(‘#formobj‘).serialize(), async: false, error: function(request) { tip("发起失败"); }, success: function(result) { frameElement.api.reload(frameElement.lhgDG); //回到datagrid页面的js中的faqi() alert(result.msg); frameElement.api.close(); //关闭弹出框dialog }, dataType:‘json‘ });}
时间: 2024-11-09 14:43:19