Should I be able to set columns.width option with data-width attribute?

Should I be able to set columns.width option with data-width attribute?

draperddraperd Posts: 10Questions: 4Answers: 0

I am trying to overcome some truly awful table formatting by IE by setting some column widths. Because the actual columns to be generated in the table are produced at runtime on the server, I thought I would use the html5 attributes as described here to set the column widths on the table itself. So for example, the code for generating one column looks like this in php:

<?php if($icol('Title')) {?><th data-width="100%">Title</th><?php } ?>

When I look at the results though, I don't see that this had any effect on the output. The headers all have width=0. Should this work? Is there something I am doing wrong?

...And if by any chance anyone has an answer to the bigger question ---- how to trick IE into decently formatting this table --- I would be delighted to hear it. I've never been able to figure out how to manage tables that have multiple breakable columns.

Debug code for this table: http://debug.datatables.net/aheruz

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 64,311Questions: 1Answers: 10,621 Site admin
    Answer ✓

    That should work. Is the table hidden when it is initialised? If so, you would need to call columns.adjust() when it is made visible.

    If it isn't hidden, I'd need a link to a page showing the issue to understand what is going wrong.

    Allan

  • draperddraperd Posts: 10Questions: 4Answers: 0
    edited November 2016

    Yes, the table was hidden. Calling columns.adjust() did the trick --- vast improvement!

This discussion has been closed.