hoist-react
hoist-react copied to clipboard
Fix autosizing to handle column with checkbox
[From @TomTirapani ]
Our preferred solution would be to leverage the autosize system with a min / max for this column - but unfortunately autosize is not accounting for the checkbox properly and will always truncate when autosized.
Having thought about this a bit more, I remembered we have this autosizeBufferPx property on Column: https://github.com/xh/hoist-react/blob/develop/cmp/grid/columns/Column.ts#L313
This adds an additional width to whatever width the autosize is calculated to. We might be able to use this to workaround the autosize issue (which is a separate issue we should address, but not one with an immediate solution).
Here's what I recommend we do:
Add a suitable autosizeBufferPx to the column when includeCheckboxes is true. It may take some experimentation to get the right value, probably something like 40. Add a suitable autosizeMinWidth and autosizeMaxWidth to the root nameCol to prevent is becoming unweildly. Set the GridModel's autosizeOptions.mode to 'managed', so that it automatically autosizes the column. https://github.com/xh/hoist-react/blob/develop/cmp/grid/enums/GridAutosizeMode.ts#L32 I think with the above we can remove the default width from nameCol and leverage the autosizing system to display the column properly without truncating.
NOTE: We may have a workaround in toolbox for this problem -- be sure to remove when this gets merged