zoukankan      html  css  js  c++  java
  • EasyUI Tabs绑定右键

    JS:

                /*为选项卡绑定右键*/
                    $("#tabs").tabs({
                        onContextMenu function(e) {
                            /* 选中当前触发事件的选项卡 */
                            var subtitle $(this).text();
                            $('#tabs').tabs('select', subtitle);
                            //显示快捷菜单
                            e.preventDefault();
                            //阻止冒泡
                            $('#menu').menu('show', {
                                left e.pageX,
                                top e.pageY
                            });
                            return false;
                        }
                    })

                //刷新
                $("#m-refresh").click(function () {
                    var currTab = $('#tabs').tabs('getSelected');    //获取选中的标签项
                    var url = $(currTab.panel('options').content).attr('src');    //获取该选项卡中内容标签(iframe)的 src 属性                 
                    if (url == null) {
                        /* 重新设置该标签 */
                        $('#tabs').tabs('update', {
                            tab: currTab,
                            options: {
                                content: '<iframe frameborder="0"  src="Tabs/Monitoring/MonitoringOfMapType.aspx" style="height: 100%;  100%;" ></iframe>'//如果用herf,容易导致样式与主页面重载,导致页面奔溃.
                            }
                        })
                    }
                    else {
                        /* 重新设置该标签 */
                        $('#tabs').tabs('update', {
                            tab: currTab,
                            options: {
                                content: '<iframe frameborder="0"  src="' + url + '"  style="height: 100%;  100%;" ></iframe>'//如果用herf,容易导致样式与主页面重载,导致页面奔溃.
                            }
                        })
                    }
                });
                //关闭所有
                $("#m-closeall").click(function () {
                    $(".tabs li").each(function (i, n) {
                        var title = $(n).text();
                        if (title != '主页') {//非主页全部关闭
                            $('#tabs').tabs('close', title);
                        }
                    });
                });
                //除当前之外关闭所有
                $("#m-closeother").click(function () {
                    var currTab = $('#tabs').tabs('getSelected');
                    currTitle = currTab.panel('options').title;
                    $(".tabs li").each(function (i, n) {
                        var title = $(n).text();
                        if (currTitle != title && title != '主页') {//除本页和主页以外全部关闭
                            $('#tabs').tabs('close', title);
                        }
                    });
                });
                //关闭当前
                $("#m-close").click(function () {
                    var currTab = $('#tabs').tabs('getSelected');
                    currTitle = currTab.panel('options').title;
                    $('#tabs').tabs('close', currTitle);
                });

    html:

    <%--右键菜单--%>
        <div id="menu" class="easyui-menu" style="width: 150px;">
            <div id="m-refresh" data-options="iconCls:'icon-reload'">
                刷新</div>
            <div class="menu-sep" data-options="iconCls:''">
            </div>
            <div id="m-closeall" data-options="iconCls:''">
                全部关闭</div>
            <div id="m-closeother" data-options="iconCls:''">
                关闭其他</div>
            <div class="menu-sep">
            </div>
            <div id="m-close" data-options="iconCls:'icon-no'">
                关闭</div>
        </div>





  • 相关阅读:
    用友U8 | 【基础设置】添加财务项目分类
    用友U8 | 【出纳管理】通过收支操作出纳收款生单,生成收款单表头信息带不过去
    MySQL经典45题(一)
    用友U8 | 【出纳管理】出纳模块银行日记账提示"已经加过类型为MD的锁"
    用友U8 | 【凭证打印】如何将凭证输出为PDF电子格式
    用友U8 | 【请购单列表】后台数据库导请购单列表
    用友U8 | 【数据权限档案分配】导出客户档案分配表
    用友U8 | 【出纳管理】收支操作,客户收款,出纳收款查询不了相关数据
    鼠标事件中鼠标的坐标是如何定义的
    Visual Studio 中各种文件后缀名是什么意思
  • 原文地址:https://www.cnblogs.com/nangong/p/4676079.html
Copyright © 2011-2022 走看看