fix search filter
This commit is contained in:
@ -16,8 +16,8 @@ const ListToolbar = () => {
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Search Menu"
|
||||
value={(table.getColumn('subMenu')?.getFilterValue() as string) ?? ''}
|
||||
onChange={(event) => table.getColumn('subMenu')?.setFilterValue(event.target.value)}
|
||||
value={(table.getColumn('name')?.getFilterValue() as string) ?? ''}
|
||||
onChange={(event) => table.getColumn('name')?.setFilterValue(event.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<DefaultTooltip title={'Filter'} placement={'top'}>
|
||||
|
||||
@ -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 }]}
|
||||
|
||||
Reference in New Issue
Block a user