"scrollx" and header of the table
"scrollx" and header of the table

With using "scrollx":true; the header collumns are changing and doesn't fits to datacilumns untill you press ordering of the column. You can see it on printscreen.
Maybe somebody knows how to fix this?)
This discussion has been closed.
Replies
I'm not seeing it here. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. 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
testcase: http://live.datatables.net/xuxejitu/1/edit
@colin even without content if you will scroll down in the right window you will see that the header {{i}} is smaller than the datacolumns. the problem begins with adding scrollx:true sorry for the view of project)
I am the new one in web programming)
also thank you for your help)
@colin if I am making some static table it's okay and it's working, but I am making some table from database with sql of user so my table is dynamic
Looks like you might need to add
style="width:100%"
to thetable
tag as demonstrated in this example.Kevin
@kthorngren for some reason it doesn't help with the header problem :c
@kthorngren the intresting part is that thead starts to fit to the columns after you cklick on thead
The problem is that you are initializing the table in a hidden element so Datatables can't determine the actual column width. You will need to use
columns.adjust()
after unhiding the table, for example:http://live.datatables.net/xuxejitu/2/edit
Also you are missing
dataTables.bootstrap.min.js
and the styling files for the buttons. The recommended way to get the proper styling files is by using the Download Builder. Also you have some duplicated CSS and JS includes which I commented out.Kevin
@kthorngren thank you very much!!!
I commented these lines:
and
I added the
columns.adjust()
to the function where you unhide the table:Kevin
@kthorngren Thank you very much!
It is not the task of discussion but maybe you also know this: maybe it is possible to make width of table columns flexible so user can change it by the mouse?
There is nothing built into Datatables to adjust the column width using the mouse. There have been a couple of third party tools created for this. They are old and people seem to have mixed success with them. You can search the forum fo rthem but here is one example. You can try them but there is no support for them if they don't work. You will need to contact the developer of the library.
Kevin
@kthorngren thank you very much for your help!