I have three columns and I wanted to add a column for removing each row.
I need to add a column for "removing" on the right. Is it possible?
How will I do it?
CODESANDBOX: CLICK HERE
const CustomTableRow = ({ row, index, arrayHelpers }) => {
return (
<>
<TableRow
sx={{
"th, td": { border: 0 }
}}
>
<TableCell component="th" scope="row">
<FastField
name={`rows.${index}.attribute`}
component={TextField}
fullWidth
/>
</TableCell>
<TableCell>
<FastField
name={`rows.${index}.ruleId`}
component={TextField}
fullWidth
/>
</TableCell>
</TableRow>
<TableRow>
<TableCell colSpan={2}>
<FastField
name={`rows.${index}.thirdRow`}
component={TextField}
fullWidth
/>
</TableCell>
</TableRow>
{/* <TableCell align="right">
<IconButton
aria-label="delete"
onClick={() => arrayHelpers.remove(index)}
size="small"
>
<RemoveCircleOutlineIcon sx={{ fontSize: "1.25rem" }} />
</IconButton>
</TableCell> */}
</>
);
};
3
Answers
Look over your imports: Verify that the appropriate Material UI components have been loaded. You should integrate the Grid component for columns.
Verify your code: Verify that the Props and Syntax for the Grid component are accurate. Make sure that the xs, sm, md, lg, and xl props add up to 12. The Grid component utilises a 12-column layout.
Make sure there are no CSS styles that clash with the Material UI designs by checking for conflicts. The And’so make use the total cost effective date and’so make use the total cost-effective date and so make use the total cost effective date and’so make use the total cost effective date and’so make use the
I think Column issue is solved and it might be helpful to you as well
Please check the file which have been updated below :
demo.js
CustomTableRow.js
Just a rough start, but edit the rows to occupy 5 columns of space, 4 for the row data/fields and 1 for the remove button. You can tweak the column spans to adjust the UI to your liking.
Table
CustomTableRow