easyui tab页面关闭根据回调函数刷新父tab页

//这个方法写在框架顶层      

CloseRefreshExcuteTab = function (callback) {

           //关闭当前tab页
            closeTab();

           //获取当前tab页id
            var currTab = $('#tabs').tabs('getSelected');
            var id = currTab.panel('options').id;
            var tabs = $('#tabs').tabs('tabs');
            var isExists = false;
            var title2 = '';
            for (var i = 0; i < tabs.length; i++) {
                if (tabs[i].panel('options').id == id) {
                    isExists = true;
                    title2 = tabs[i].panel('options').title;
                    break;
                }
            }
            if (isExists) {
                $('#tabs').tabs("select", title2);
            }
            else {
                $('#tabs').tabs("select", '欢迎使用');
            }
            var currTab2 = $('#tabs').tabs('getSelected');
            var ssrc = $(currTab2.panel('options').content)[0].src;
            for (i = 0; i < window.frames.length; i++) {
                var aa = window.frames[i].location.href;
                if (ssrc == aa || (ssrc + '#') == (aa)) {
                    var f = 'frames[i].frameElement.contentWindow.' + callback+'()';
                    eval(f);
                }
            }
      
        }

        closeTab = function () {
            var index = $('#tabs').tabs('getTabIndex', $('#tabs').tabs('getSelected'));
            if (index != 0) {
                $('#tabs').tabs('close', index);
            }

        }

子页面调用

   window.top.CloseRefreshExcuteTab('refreshTab');

父页面方法

function refreshTab() {
    $("#maingrid").datagrid("reload");
    $("#maingrid_ed").datagrid("reload");
}

posted @ 2018-09-20 09:58  lbja2  阅读(1729)  评论(0编辑  收藏  举报