scrollX not work with fixed column width

scrollX not work with fixed column width

yusranyusran Posts: 2Questions: 0Answers: 0
edited November 2015 in Free community support

Hi All...
Can i activated scrollx with fixed column width??

my code like:

var table = $('#table').dataTable({
"scrollX": true,
"aoColumns": [
{ "sWidth": "130px" },
{ "sWidth": "20px" },
{ "sWidth": "80px" },
{ "sWidth": "160px" },
{ "sWidth": "100px" },
{ "sWidth": "80px" },
{ "sWidth": "80px" },
{ "sWidth": "50px" },
{ "sWidth": "100px" },
{ "sWidth": "100px" },
{ "sWidth": "120px" },
{ "sWidth": "80px" },
{ "sWidth": "50px" },
{ "sWidth": "50px" },
{ "sWidth": "80px" },
{ "sWidth": "80px" },
{ "sWidth": "20px" }
]
});

The scrollX is working but not with the column width...
If i remove the "scrollX": true, column witdh is working..
can the both working well?

Replies

  • yusranyusran Posts: 2Questions: 0Answers: 0
  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    I think that the scrollx creates a 2nd table, so that breaks the relationship between the columb widths in the header and the body, say if the content messes with it.

    Not sure if theres a fix

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin

    Can you link to a test case showing the issue, as per the forum rules, please. This should work okay - there is a second table, but Javascript is used to align the two tables. We'd need a test case to understand why it isn't working.

    Please also ensure that you are using DataTables 1.10.10 which fixes a number of column width issues from previous versions.

    Allan

This discussion has been closed.