DataTable tweaks
Summary: Found a small issue in the column width calculation where initial invisible columns still got space assigned. Reviewed By: passy Differential Revision: D28221659 fbshipit-source-id: ef052533bc37bc833bab72979803ce36bcf50e61
This commit is contained in:
committed by
Facebook GitHub Bot
parent
23402dfff6
commit
84d65b1a77
@@ -94,6 +94,9 @@ export const DataList: React.FC<DataListProps<any>> = function DataList<
|
||||
const tableManagerRef = tableProps.tableManagerRef ?? createRef<undefined | DataTableManager<T>>();
|
||||
|
||||
useAssertStableRef(baseSelection, 'selection');
|
||||
useAssertStableRef(onRenderItem, 'onRenderItem');
|
||||
useAssertStableRef(enableArrow, 'enableArrow');
|
||||
|
||||
// create local selection atom if none provided
|
||||
// eslint-disable-next-line
|
||||
const selection = baseSelection ?? useState(() => createState<string|undefined>())[0];
|
||||
|
||||
@@ -443,8 +443,9 @@ function computeInitialColumns(
|
||||
columns: DataTableColumn<any>[],
|
||||
): DataTableColumn<any>[] {
|
||||
const visibleColumnCount = columns.filter((c) => c.visible !== false).length;
|
||||
const columnsWithoutWidth = columns.filter((c) => c.width === undefined)
|
||||
.length;
|
||||
const columnsWithoutWidth = columns.filter(
|
||||
(c) => c.visible !== false && c.width === undefined,
|
||||
).length;
|
||||
|
||||
return columns.map((c) => ({
|
||||
...c,
|
||||
|
||||
Reference in New Issue
Block a user