thefantas / jquery-ui-tabs-paging

Automatically exported from code.google.com/p/jquery-ui-tabs-paging
0 stars 0 forks source link

After some number of added tabs the plugin crashes #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
after adding many tabs the plugin crashes.

I'm using some plugins to enhance the tables inside the panels in my app.

I don't know why but when i add the 3rd tab int the 2nd page the plugin doesn't 
activates the last added tab and that makes that the table plugin crashes.

This is some of my code.

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();
            }
        });
    }

AND THIS IS THE CODE FOR THE TABS

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');

Original issue reported on code.google.com by rickardoberdejo on 28 Dec 2012 at 2:31

GoogleCodeExporter commented 9 years ago
Before adding or removing any tabs, be sure to using "pagingDestroy" to turn 
off the paging and then re-initialize the paging after you've changed the tabs.

See this: http://jsfiddle.net/seyfert/RZ9qM/6/

Original comment by brian.se...@gmail.com on 30 Dec 2012 at 9:00

GoogleCodeExporter commented 9 years ago
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();

Thank you and you are doing a GREAT WORK

Original comment by rickardoberdejo on 2 Jan 2013 at 3:42

GoogleCodeExporter commented 9 years ago

Original comment by brian.se...@gmail.com on 2 Jan 2013 at 4:28