zoukankan      html  css  js  c++  java
  • 点击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?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,
    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,
    //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'
    });
    }


  • 相关阅读:
    uvm_reg_map——寄存器模型(八)
    uvm_reg_block——寄存器模型(七)
    mysql_secure_installation 安全安装(用于生产环境设置)
    一键安装nginx-1.12.2
    nginx优化之隐藏版本号
    shell script 之六:循环 while
    shell script 之五:循环控制 for
    shell script 之四:流程控制 if 分支语句
    shell script 之三:打印输出 echo printf
    shell script 之一:变量和赋值
  • 原文地址:https://www.cnblogs.com/xlj227/p/5769374.html
Copyright © 2011-2022 走看看