Fixed table header displaying Title Case instead of normal

This commit is contained in:
Lucas Oliveira 2024-06-13 18:22:16 -03:00
commit 94d7f4a9cb

View file

@ -35,12 +35,11 @@ const TableComponent = forwardRef<
alertDescription = DEFAULT_TABLE_ALERT_MSG,
...props
},
ref
ref,
) => {
let colDef = props.columnDefs.map((col, index) => {
let newCol = {
...col,
headerName: toTitleCase(col.headerName),
};
if (index === props.columnDefs.length - 1) {
newCol = {
@ -111,7 +110,7 @@ const TableComponent = forwardRef<
};
const onColumnMoved = (params) => {
const updatedColumnDefs = makeLastColumnNonResizable(
params.columnApi.getAllGridColumns().map((col) => col.getColDef())
params.columnApi.getAllGridColumns().map((col) => col.getColDef()),
);
params.api.setGridOption("columnDefs", updatedColumnDefs);
if (props.onColumnMoved) props.onColumnMoved(params);
@ -135,7 +134,7 @@ const TableComponent = forwardRef<
className={cn(
dark ? "ag-theme-quartz-dark" : "ag-theme-quartz",
"ag-theme-shadcn flex h-full flex-col",
"relative"
"relative",
)} // applying the grid theme
>
<AgGridReact
@ -152,7 +151,7 @@ const TableComponent = forwardRef<
if (e.sources.some((source) => source.includes("column"))) {
localStorage.setItem(
storeReference,
JSON.stringify(realRef.current?.api?.getColumnState())
JSON.stringify(realRef.current?.api?.getColumnState()),
);
setColumnStateChange(true);
}
@ -175,7 +174,7 @@ const TableComponent = forwardRef<
)}
</div>
);
}
},
);
export default TableComponent;