Fixed Header on Datatables changes width of columns assigned in percentages

Fixed Header on Datatables changes width of columns assigned in percentages

manojmilani123manojmilani123 Posts: 4Questions: 2Answers: 0
edited September 2018 in Free community support

Hello,

I have below settings on my datatables.

"fixedHeader": true,
"autoWidth": false,
"columnDefs": [ 
            { "targets"  : 'no-sort',  "orderable": false },
            { "orderSequence": ["desc", "asc"], "targets"  : '_all'},
            { "width": "20%", "targets": 0 },
            { "width": "5%", "targets": 1 },
            { "width": "9%", "targets": 2 },
            { "width": "4%", "targets": 3 },
            { "width": "3%", "targets": 4 },
            { "width": "2%", "targets": 5 },
        ],

Problem is I am using responsive plugin, have enabled fixedheaders and when I scroll down, it shows fixed header with the percentages being assigned on the column headers in percentages. But as soon as I scroll back up, it loses the inline percentages that are assigned to header columns. Any solution for this? I need to keep the column width's in percentages as defined by columnDefs.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,236Questions: 1Answers: 2,598

    Hi @manojmilani123 ,

    We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • manojmilani123manojmilani123 Posts: 4Questions: 2Answers: 0

    Below is the link to the working page. You can see after you scroll down, it has fixed header with columns being assigned inline width in percentages. And after you scroll back up, it removes the percentages from the column headers. Fix to this solutions would be appreciated.

    https://bit.ly/2Q1xjB1

  • allanallan Posts: 62,992Questions: 1Answers: 10,367 Site admin
    Answer ✓

    Could you remove the autoWidth option from your configuration of the DataTable please?

    Allan

  • manojmilani123manojmilani123 Posts: 4Questions: 2Answers: 0

    Thank you very much. It works now!!!

This discussion has been closed.