Fixed table header displaying Title Case instead of normal
This commit is contained in:
parent
6322827ad6
commit
6685ca32bb
1 changed files with 5 additions and 6 deletions
|
|
@ -35,12 +35,11 @@ const TableComponent = forwardRef<
|
||||||
alertDescription = DEFAULT_TABLE_ALERT_MSG,
|
alertDescription = DEFAULT_TABLE_ALERT_MSG,
|
||||||
...props
|
...props
|
||||||
},
|
},
|
||||||
ref
|
ref,
|
||||||
) => {
|
) => {
|
||||||
let colDef = props.columnDefs.map((col, index) => {
|
let colDef = props.columnDefs.map((col, index) => {
|
||||||
let newCol = {
|
let newCol = {
|
||||||
...col,
|
...col,
|
||||||
headerName: toTitleCase(col.headerName),
|
|
||||||
};
|
};
|
||||||
if (index === props.columnDefs.length - 1) {
|
if (index === props.columnDefs.length - 1) {
|
||||||
newCol = {
|
newCol = {
|
||||||
|
|
@ -111,7 +110,7 @@ const TableComponent = forwardRef<
|
||||||
};
|
};
|
||||||
const onColumnMoved = (params) => {
|
const onColumnMoved = (params) => {
|
||||||
const updatedColumnDefs = makeLastColumnNonResizable(
|
const updatedColumnDefs = makeLastColumnNonResizable(
|
||||||
params.columnApi.getAllGridColumns().map((col) => col.getColDef())
|
params.columnApi.getAllGridColumns().map((col) => col.getColDef()),
|
||||||
);
|
);
|
||||||
params.api.setGridOption("columnDefs", updatedColumnDefs);
|
params.api.setGridOption("columnDefs", updatedColumnDefs);
|
||||||
if (props.onColumnMoved) props.onColumnMoved(params);
|
if (props.onColumnMoved) props.onColumnMoved(params);
|
||||||
|
|
@ -135,7 +134,7 @@ const TableComponent = forwardRef<
|
||||||
className={cn(
|
className={cn(
|
||||||
dark ? "ag-theme-quartz-dark" : "ag-theme-quartz",
|
dark ? "ag-theme-quartz-dark" : "ag-theme-quartz",
|
||||||
"ag-theme-shadcn flex h-full flex-col",
|
"ag-theme-shadcn flex h-full flex-col",
|
||||||
"relative"
|
"relative",
|
||||||
)} // applying the grid theme
|
)} // applying the grid theme
|
||||||
>
|
>
|
||||||
<AgGridReact
|
<AgGridReact
|
||||||
|
|
@ -153,7 +152,7 @@ const TableComponent = forwardRef<
|
||||||
if (e.sources.some((source) => source.includes("column"))) {
|
if (e.sources.some((source) => source.includes("column"))) {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
storeReference,
|
storeReference,
|
||||||
JSON.stringify(realRef.current?.api?.getColumnState())
|
JSON.stringify(realRef.current?.api?.getColumnState()),
|
||||||
);
|
);
|
||||||
setColumnStateChange(true);
|
setColumnStateChange(true);
|
||||||
}
|
}
|
||||||
|
|
@ -176,7 +175,7 @@ const TableComponent = forwardRef<
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
export default TableComponent;
|
export default TableComponent;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue