1

添加许多选项卡后,插件崩溃。我正在使用一些插件来增强我的应用程序面板内的表格。我不知道为什么,但是当我将第三个选项卡添加到第二页时,插件不会激活最后添加的选项卡,这会使表插件崩溃。

这是我的一些代码:

int port = 18000;
DatagramSocket serverSocket = new DatagramSocket(port);
byte[] receiveData = new byte[8];
System.out.println("Server Listing on Port: "+port);
String x;
while (true)
{
    DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
    serverSocket.receive(receivePacket);

function addSearchResult(title, content) {
    id = "tabs-" + tabId.toUpperCase(),
    li="<li><a href='#"+id+"'>"+title.toUpperCase()+"</a><span class='ui-icon ui-icon-close'></span></li>";
    tabs.find( ".ui-tabs-nav" ).append( li );
    tabs.append( "<div id='" + id + "'>" + content + "</div>" );
    tabs.tabs( "refresh" );
    $('#modal').trigger('close');
    tabs.tabs('option','active', $('#'+id).index()-1);
    indexTab++;
    $(".activo").find('.tablaQuotes, .tablaCuatro, .tablaCinco, .tablaSeis').dataTable({
        "aaSorting": [[1,'desc']]
    });
    $(".activo").find('.other').find('.tabui').dataTable({
        "aaSorting": [[2,'desc']],
        "iDisplayLength": 5
    });
    $(".activo").find('.gal').carouFredSel({
        circular:false,
        infinite:false
    });
    $(".activo").find(".grupo").colorbox({
        rel:'pt-'+tabId, transition:"none", width:"75%", height:"75%",
        onComplete:function(){
            $('#cboxLoadedContent').zoom();
        }
    });
}

这是标签的代码:

var tabs = $( "#tabs" ).tabs({
    beforeActivate: function( event, ui ){
    },
    create: function( event, ui ){
    },
    activate: function( event, ui ){
        $('div').removeClass('activo');
        ui.newPanel.addClass('activo');
    }
});


$( "#tabs" ).tabs('paging');
4

2 回答 2

1

检查您正在使用的插件的渲染 HTML 输出和 Javascript,因为我发现旧的“globalPanel”功能在 jQuery 1.9 中不再有效。选项卡的所有内容都必须是选项卡元素的后代。

于 2012-12-31T14:53:08.990 回答
0

Well I've fixed it. i just add $('#tabs').tabs('pagingDestroy'); and $('#tabs').tabs('paging');

to destroy and initialize the plugin each time i add a new tab. I was doing this first but i was doing it in a wrong place ( inside beforeActivate() ), that why never worked. i just moved to addSearchResult();

于 2013-01-02T15:41:43.020 回答