fix search filter

This commit is contained in:
Wikzyy
2025-03-24 11:45:22 +07:00
parent ab943cd99e
commit 3f995cfa38
2 changed files with 7 additions and 6 deletions

View File

@ -118,7 +118,7 @@ const ManageMenusContextProvider = ({ children }: { children: React.ReactNode })
},
{
accessorFn: (row) => row.name,
id: 'subMenu',
id: 'name',
header: ({ column }) => <DataGridColumnHeader title="Sub Menu" column={column} />,
enableSorting: false,
enableHiding: false,
@ -210,7 +210,8 @@ const ManageMenusContextProvider = ({ children }: { children: React.ReactNode })
page: page + 1,
with_deleted: false,
order_field: sorting[0].id,
order_direction: sorting[0].desc ? 'DESC' : 'ASC'
order_direction: sorting[0].desc ? 'DESC' : 'ASC',
filter: JSON.stringify(filter)
});
if (!response?.data.list) return { data: [], totalCount: 0 };
@ -223,7 +224,7 @@ const ManageMenusContextProvider = ({ children }: { children: React.ReactNode })
console.log(response.data);
setMenus(transformedData);
return { data: transformedData, totalCount: response.data.total_count };
return { data: transformedData, totalCount: total_count };
} catch (error) {
console.error('Error fetching Menus', error);
return { data: [], totalCount: 0 };
@ -250,7 +251,7 @@ const ManageMenusContextProvider = ({ children }: { children: React.ReactNode })
<DataGridProvider
columns={columns}
pagination={{ size: 30 }}
pagination={{ size: 50, page: 0, more: false }}
toolbar={<ListToolbar />}
layout={{ card: true }}
sorting={[{ id: 'id', desc: false }]}