fix searching and pagination after filtering

This commit is contained in:
Wikzyy
2025-04-16 14:07:14 +07:00
parent 1ddda4d478
commit ed4b2f1471
7 changed files with 27 additions and 6 deletions

View File

@ -16,6 +16,7 @@ const ListToolbar = () => {
const handleSearch = () => {
table.getColumn('sucos_name')?.setFilterValue(searchValue);
table.setPageIndex(0);
};
return (

View File

@ -159,7 +159,7 @@ const ManageSucosContextProvider = ({ children }: { children: React.ReactNode })
filter: JSON.stringify(filter)
});
// console.log('Sucos List Response:', response?.data);
setSucos(response?.data.list || []); // Pastikan default value adalah array kosong
setSucos(response?.data.list || []);
return { data: response?.data.list, totalCount: response?.data.total_count };
} catch (error) {
console.error('Error fetching Sucos', error);