Grid: fixed table width, resizable columns

Hello,

it is possible to have a fixed table width and resizable columns whose width still remain equal to the table width?



FOr example, for a 2-column table with a width of 400px, I want column1.width + column2.width = 400px while I’m changing column1.width from 0 to 400px with the mouse on the client side? THe current behavior seems to extends the size of the table as the user extends the width of a column. This creates an horizontal scrollbar and I’d like to avoid it.



Thank you

There are two possible solution

a) make table auto adjustable - table will change size to prevent scrolling or empty space

    grid.enableAutoWidth(true)

or

b) make some column auto adjustable - in example below second column size defined as automatic, so it will increase|decrease its size to prevent scrolling

    grid.setInitWidths(“100,*”);

Thank you for the quick Answer. The first suggestion does not work, the grid is not didpalyed at all. I didn’t see this method in the API list (enableAutoHeight is there, but not enableAutoWidth). It is available in 1.4?

As for the second suggestion, it works well when I release the mouse. But while I am resizing one column, the scroll bar is apparent and the second column widts is not adjusted on the fly.

BTW, I am using the 1.4 free version of the Grid.

Thank you

>>The first suggestion does not work, the grid is not didpalyed at all
Unfortunately problem can’t be reconstructed with local samples. I think it can be caused by the way the grid initialized or by surrounding layout - can you please provide full js initialization code ( or any kind of sample where problem can be reconstructed ) - you can send it directly to support@dhtmlx.com. If you set wixed width in setInitWidths - the grid must resize according to them, in case of procent based width - it not so predictable.

>>But while I am resizing one column, the scroll bar is apparent and the second column widts is not adjusted on the fly.
Such behavior will occur for first solution as well. Table resizing on the fly can be time consuming, so it fully done only after end of resize ( to prevent choppy view ), if necesary I can provide info which code need to modified to made resize appear on the fly.