evrencoskun / TableView

TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
MIT License
3.14k stars 459 forks source link

setColumnWidth() does not seem to do anything immediately #339

Open pandalion98 opened 4 years ago

pandalion98 commented 4 years ago

Issue

Is there a way to immediately apply setColumnWidth()? In its current state, the column needs to disappear from view in order for the width to be applied.

Attempted solutions

I've already tried requestLayout(), forceLayout(), invalidate(), and a combination of them on the TableView to no avail.

Further info/context

Here's a gif to illustrate. I've set column 3 to 800px using setColumnWidth(), but it does not update until it disappeared from view. ezgif-2-62cac79f30c1

pandalion98 commented 4 years ago

I've found that setColumnWidth() only works with indexes based on the actual table, and not my data's index.

For example, I have columns {0, 1, 2, 3, 4}. I hid column 2. The visible columns would then be {0, 1, 3, 4}. If I wanted to resize column 3, I would need to call setColumnWidth(2), where 2 is the visible position of column 3.

Maybe this info helps someone out.

MGaetan89 commented 3 years ago

Good catch! I've submitted #376 to fix this issue.