Table/column widths when columns are changing

Table/column widths when columns are changing

KorijnKorijn Posts: 1Questions: 0Answers: 0
edited June 2011 in DataTables 1.8
Hello DataTables users,

In a project I'm working on I've implemented a "group by columns" feature into DataTables. This works by reinitializing the table with a subset of the originally available columns. The datatable gets it data server side.

So basically, whenever the user selects a subset of columns to group his data by, the number and order of columns is altered. Therefore I cannot implement specific column widths without doing all sorts of harsh checks (searching for the header of a column and comparing the title displayed with a width dictionary) that I'd like to stay away from. The amount of columns can be very high (up to 50) or very low depending on the user's selection (8 columns).

So the problem here is; how do I make sure the column widths are set properly, preferably in a reusable, maintainable way?

I've read about automatic width calculations but it appears to me that these fail whenever the table is too wide to fit the viewport. I understand that it would be pretty difficult to calculate proper widths when the table is wider than the viewport as well. But it leaves me wondering what to do. I've tried fiddling with various settings but I'm about to give up and just set the width to a high value. Unfortunately that will look very strange when there are only 8 columns (lots of blank space).
This discussion has been closed.