Change column width programmatically

Tags: #<Tag:0x00007efc654dab30>

Hi,

Is there a way to change the width of a column programmatically? Or reset all the column widths to the initial list of widths defined for a table? I have a setup with fixed columns on the left, manual column resize and a script that saves the widths to the database. But, sometimes the users are making the columns from the fixed area too large and the fixed area exceeds the width of the screen, so it is impossible for them to reach the right margin of the column and drag it back in order to decrease the width (the scroll only works in the visible part of the fixed area). So, I was thinking about adding a custom option to the contextMenu or a button that will allow them to reset the width of the column to the initials values, but I couldn’t find the right code to do this programmatically.

Roxana

Hi @roxanalupu1981

We will check your issue and get back to you soon.

Hi @roxanalupu1981

You can change the column width by using manualColumnResize plugin. Here you can find a solution where the column width after manual resize is being restored to the saved width values. The function is attached to custom contextMenu option.

http://jsfiddle.net/aszymanski/s53c4nad/1/

It seems to be the only solution for now as return false does not work within the beforeColumnResize hook. It is not yet supported.