From 88dec0d087045fd2df896554ad6ab9b997cae569 Mon Sep 17 00:00:00 2001 From: faisolavolut Date: Tue, 25 Feb 2025 14:14:03 +0700 Subject: [PATCH] feat: integrate event parameters into onCount function for enhanced data loading --- components/tablelist/TableList.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/tablelist/TableList.tsx b/components/tablelist/TableList.tsx index 7e100d8..07de147 100644 --- a/components/tablelist/TableList.tsx +++ b/components/tablelist/TableList.tsx @@ -25,6 +25,7 @@ import get from "lodash.get"; import { Checkbox } from "../ui/checkbox"; import { getNumber } from "@/lib/utils/getNumber"; import { formatMoney } from "@/lib/components/form/field/TypeInput"; +import { events } from "@/lib/utils/event"; export const TableList: React.FC = ({ autoPagination = true, @@ -71,6 +72,7 @@ export const TableList: React.FC = ({ dataForm: [] as any[], listData: [] as any[], sort: {} as any, + filter: {} as any, search: null as any, paging: 1, count: 0 as any, @@ -118,7 +120,13 @@ export const TableList: React.FC = ({ ); if (typeof onCount === "function") { - const res = await onCount(); + const params = await events("onload-param", { + take: 1, + paging: 1, + search: local.search, + ...local.filter, + }); + const res = await onCount(params); local.count = res; local.render(); }