Datatable adjust not working

Datatable adjust not working

radekwojtkiewicz88radekwojtkiewicz88 Posts: 1Questions: 1Answers: 0

I have a problem where my brain is already cooking. So I'm counting on your help modest. Trying to use a function that sets the appropriate column widths. I need to set it up as wide a smash after adding, for example, the icon for the column titles, create a table footer.

The problem looks that when I remove filter(I`v got a selected filter by default on the start):

https://s17.postimg.org/5cyfvy5m7/start.png

As you can see column widths are not compatible with rows data after remove filter.

Bu when click f12 and open console it look like this:

https://s15.postimg.org/r6uezfggb/after_filter.png

So columns now are correctly. But when I next change page, filter or do something whhere must reload, redraw columns back to bad widths.

I try add to function where remove filter:

GUI.prototype.drawTable = function() {
        this.setFilterInRequestsData();

        var datatable = $('#' + this.datatable.sTableId).DataTable();
        datatable.columns.adjust().draw();
    };

But it not help.

I try to add to:

$('#example').DataTable().columns.adjust().draw();

I would like to make these columns were converted every time the DataTable is reloading, redrawn.

So I dont understand why when I open console by f12 columns are good but on the start and reload, redraw columns are bad.

Please help me to solve this problem.

I try too do that:

App.dataTable = $('#example').DataTable({
    "initComplete": function (settings, json) {
        if (data.config.hasOwnProperty("notice")) {
            App.noticeHeight = $("#notice").height() - 10;
        } else {
            App.noticeHeight = 0;
        }

        $(window).bind('resize', function () {
            adjustHeight(App.noticeHeight);
        });


        App.dataTable.columns.adjust().draw();//not working
        this.api().columns.adjust().draw();//not working
    },
});
This discussion has been closed.