angular2-smart-table icon indicating copy to clipboard operation
angular2-smart-table copied to clipboard

Table is losing the configured columns width on filter, pagination, etc.

Open uap-universe opened this issue 3 years ago • 3 comments

In the table settings you can specify the desired width of a column,

However, when you use table filters or the pagination, the widths of the columns automatically adjust and seem to ignore the predefined widths (at least the new widths do not seem to come even close to what was configured).

This bug is very tricky to fix, because in contrast to the original ng2-smart-table, this fork of the smart-table supports changing the column width via drag&drop. I.e. we have to respect two settings: 1) the original width from the settings object and 2) a possible user defined width that has been selected at runtime.

I did not quite understand how the column resizing works (and imho it's very laggy and unpredictable), so I cannot provide a solution idea just yet.

uap-universe avatar Apr 06 '22 07:04 uap-universe

i think that the best way is to ignore the original width from the settings when d&d is enabled, what do you think?

dj-fiorex avatar Apr 30 '22 11:04 dj-fiorex

This would break many pre-configured tables as d&d is enabled by default. I need to investigate and understand more how the width of a column is maintained. There are so many factors that play into this. E.g. there is the use case of providing a custom renderer that uses text-overflow: ellipsis within a cell. That requires a certain width for the content div to properly work. Having the table auto-adjust for the content turns the logic around. So we have two conflicting approaches here: (1) the table wants to adjust the width of a column s.t. the content fits in and (2) the user wants to limit the width of a column and uses overflow properties (e.g. for previewing long texts).

I don't really know yet, what the most general solution would be to cover all cases.

uap-universe avatar May 03 '22 11:05 uap-universe

Maybe this is also resolved by #68

Update: or maybe not... a fixed table layout would be a breaking change for many users and is likely to cause cell overflows when the specified column width is not sufficient to contain the data (at least as long text-overflow: ellipsis is not default).

uap-universe avatar Jun 08 '22 14:06 uap-universe