jayralencar / bootstrap-dynamic-tabs

Plugin jQuery para manipular tabs do bootstrap de forma dinâmica
MIT License
13 stars 7 forks source link

Tabs Sorting Issue #1

Open ravisojitra opened 7 years ago

ravisojitra commented 7 years ago

I got the code for the tabs and its working properly but when it comes to sorting it sorts the first tab only ALAS I'm getting the tabs and data dynamic. I can't get where I'm getting wrong, also compared the files with your GIT but I found no difference, Kindly help me as soon as possible.

jayralencar commented 7 years ago

Hi, Can you show me your code?

ravisojitra commented 7 years ago

Code is too messy and i am generating those tabs with ajax. Does it generate any flaw?

ravisojitra commented 7 years ago

    var tabs = $('#tabs').bootstrapDynamicTabs().addTab({
        title:'Location List',
        html:function(){
         return jQuery("#data_usage_history").html();
     },
     closable: false,
     icon: 'fa fa-list'
 });

    function GetCompany(ipaddress,location_name){
        tabs.addTab({
            title:location_name,
            html: function(){
                $.ajax({
                    type:'POST',
                    data:{'nasip':ipaddress,'daterange':$('#daterange').val(),'location_name':location_name},
                    url:'<?php echo base_url();?>Dashboard/Get_users',
                    beforeSend:function(){
                        toastr.clear();
                        setTimeout(function() {
                            toastr.options = {
                                closeButton: true,
                                progressBar: true,
                                showMethod: 'slideDown',
                                timeOut: 4000
                            };
                            toastr.info('Please Wait! Loading Data...');

                        }, 1300);
                    },
                    success:function(data){
                        toastr.clear();
                        $('#'+location_name.replace(/\s+/g, '').toLowerCase()).html(data);
                        $('#'+location_name.replace(/\s+/g, '').toLowerCase()+'_table').DataTable(
                        {
                            pageLength: 10,
                            lengthMenu: [ [5, 10, 25, 50, -1], [5, 10, 25, 50, "All"] ],
                            responsive: true,
                            searching: false,
                            sorting:false,

                        });
                    }

                })
            }
        })
    }
    function GetUser(userId) {
        tabs.addTab({
            title:"User : "+userId,
            html: function(){
                $.ajax({
                    type:'POST',
                    data:{'userId':userId},
                    url:'<?php echo base_url();?>Dashboard/Get_Details',
                    beforeSend:function(){
                        toastr.clear();
                        setTimeout(function() {
                            toastr.options = {
                                closeButton: true,
                                progressBar: true,
                                showMethod: 'slideDown',
                                timeOut: 4000
                            };
                            toastr.info('Please Wait! Loading Data...');

                        }, 1300);
                    },
                    success:function(data){
                        $('#user'+userId.replace(/[-]+/g, '').toLowerCase()).html(data);
                        $('#'+userId+'_table').DataTable({
                            pageLength: 10,
                            responsive: true,
                            searching: false,
                            dom: '<"html5buttons"B>lgtip',
                            buttons: [{extend: 'copy'},{extend: 'csv', title: userId+' Detail'},{extend:'pdf',title: userId+' Detail'}]
                        });
                    }

                })
            }
        })

    }