Set Column widths to specific pixel size
Set Column widths to specific pixel size
Hi,
I have scoured the documentation to find an answer for this, but keep coming up short. I have a table that needs to have some columns set to different widths than others, and the autowidth function isn't cutting it (see the comments column in the linked screenshot below).
This is an internal site, so I can't share a link to the page, but I do have a screenshot here. Also Here is a JSFiddle link to the relevant code.
What I would like (minimally) is to be able to assign a set pixel width to each column, and have it stick. I understand that I will not get pixel perfect control due to browser shenanigans, and that's fine - a general target would be great. IDEALLY, I would like to assign a pixel width to that comments column, and then have every <td> in there have an overflow: scroll; option.
Does anyone have any ideas or suggestions here? I also have a license for editor, is it possible there is something in that library I can use?
This question has an accepted answers - jump to answer
Answers
Actually, I believe I figured it out. In this case, I seem to have been using the columnDefs.targets param wrong. Setting 1 param to "_all" seems to fix my issue with all columns, and it looks like setting individual targets and assigning them a width will fix my overall issue.
Adding a link to the relevant documentation here for any future searchers
Thanks for posting back - good to hear you've got it working now!
Allan