Issue with Responsive DataTables And Bootstrap Tabs

后端 未结 2 1124
无人共我
无人共我 2020-12-31 07:55

I want to use Datatables and Responsive extension inside Bootstrap Tabs. I have this working separately.

$(document).ready(function() {
    $(\'#example\').D         


        
2条回答
  •  余生分开走
    2020-12-31 08:05

    I tried the answers above but none worked. I was using JQuery Steps Wizard as tabs. I had to use $('#datatable').css("width", '100%') as well for it to work.

    wizard.steps({
                headerTag: "h3",
                bodyTag: "section",
                transitionEffect: "slideLeft",
                enableFinishButton: false,
                enablePagination: false,
                enableAllSteps: true,
                titleTemplate: "#title#",
                cssClass: "tabcontrol",
                onStepChanged: function (event, currentIndex, priorIndex) {
    
                    if (currentIndex == 2) {
                        $('#datatable').css("width", '100%')
                        $($.fn.dataTable.tables(true)).DataTable().columns.adjust().responsive.recalc();
                    }
                }
            })
    

    My Datatable is on the 3rd tab hence the check on the currentIndex.

提交回复
热议问题