src/main/webapp/jquery-easyui-1.3.3/src/jquery.tabs.js
/**
     * close a tab with specified index or title
     */
close a tab with specified index or title
close a tab with specified index or title
function closeTab(container, which) {
        var opts = $.data(container, 'tabs').options;
        var tabs = $.data(container, 'tabs').tabs;
        var selectHis = $.data(container, 'tabs').selectHis;
        if (!exists(container, which)) return;
        var tab = getTab(container, which);
        var title = tab.panel('options').title;
        var index = getTabIndex(container, tab);
        if (opts.onBeforeClose.call(container, title, index) == false) return;
        var tab = getTab(container, which, true);
        tab.panel('options').tab.remove();
        tab.panel('destroy');
        opts.onClose.call(container, title, index);
        setScrollers(container);
        for (var i = 0; i < selectHis.length; i++) {
            if (selectHis[i] == title) {
                selectHis.splice(i, 1);
                i--;
            }
        }
        var hisTitle = selectHis.pop();
        if (hisTitle) {
            selectTab(container, hisTitle);
        } else if (tabs.length) {
            selectTab(container, 0);
        }
    }
function closeTab ( container , which ) { var opts = $ . data ( container , 'tabs' ) . options ; var tabs = $ . data ( container , 'tabs' ) . tabs ; var selectHis = $ . data ( container , 'tabs' ) . selectHis ; if ( ! exists ( container , which ) ) return ; var tab = getTab ( container , which ) ; var title = tab . panel ( 'options' ) . title ; var index = getTabIndex ( container , tab ) ; if ( opts . onBeforeClose . call ( container , title , index ) == false ) return ; var tab = getTab ( container , which , true ) ; tab . panel ( 'options' ) . tab . remove ( ) ; tab . panel ( 'destroy' ) ; opts . onClose . call ( container , title , index ) ; setScrollers ( container ) ; for ( var i = 0 ; i < selectHis . length ; i ++ ) { if ( selectHis [ i ] == title ) { selectHis . splice ( i , 1 ) ; i -- ; } } var hisTitle = selectHis . pop ( ) ; if ( hisTitle ) { selectTab ( container , hisTitle ) ; } else if ( tabs . length ) { selectTab ( container , 0 ) ; } }
close a tab with specified index or title
close a tab with specified index or title
// remove the select history item // select the nearest tab panel