點擊datagrid彈出ldhdialog,點擊彈出框的按鈕,關閉且刷新datagrid


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);
}
//寫一個ldhdialog
function 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'
});
}



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM