add mutate on row actions

This commit is contained in:
2024-09-22 07:33:19 +00:00
committed by AmirHossein Mahmoodi
parent f25f6ec962
commit b590095c23
20 changed files with 257 additions and 267 deletions

View File

@@ -21,6 +21,7 @@ const DataTable_Main = (props) => {
initialStateProps,
TableToolbar,
table_title,
RowActions,
} = props;
const flatColumns = flattenArrayOfObjects(columns, "columns");
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
@@ -106,11 +107,8 @@ const DataTable_Main = (props) => {
manualSorting: true,
onPaginationChange: setPagination,
onSortingChange: onSortingChange,
renderTopToolbarCustomActions: ({ table }) => (
<>
{TableToolbar && <TableToolbar mutate={mutate} />}
</>
),
renderTopToolbarCustomActions: ({ table }) => <>{TableToolbar && <TableToolbar mutate={mutate} />}</>,
renderRowActions: ({ row }) => <RowActions row={row} mutate={mutate} />,
...props,
});

View File

@@ -3,11 +3,6 @@ import { useAuth } from "@/lib/contexts/auth";
const DataTableWithAuth = (props) => {
const { user } = useAuth();
return (
<DataTable
user_id={user.username}
{...props}
/>
);
return <DataTable user_id={user.username} {...props} />;
};
export default DataTableWithAuth;