update table on manage group

This commit is contained in:
Wikzyy
2025-04-15 21:11:09 +07:00
parent f71b203eb7
commit c51889d440
3 changed files with 178 additions and 98 deletions

View File

@ -1,3 +1,4 @@
import { KeenIcon } from '@/components';
import { ColumnDef } from '@tanstack/react-table';
export type Group = {
@ -8,7 +9,7 @@ export type Group = {
description: string;
};
export const columns: ColumnDef<Group>[] = [
export const getColumns = (handleUpdate: (data: any) => void): ColumnDef<Group>[] => [
{
accessorKey: 'no',
header: 'ID'
@ -30,8 +31,19 @@ export const columns: ColumnDef<Group>[] = [
accessorKey: 'description',
header: 'Description'
},
// {
// id: 'actions',
// header: 'Actions'
// }
{
id: 'actions',
cell: ({ row }) => {
const dataMembers = row.original;
return (
<button
className="btn btn-sm btn-icon btn-clear btn-light"
onClick={() => handleUpdate(dataMembers)}
>
<KeenIcon icon="notepad-edit" />
</button>
);
}
}
];