feat: integrate event parameters into onCount function for enhanced data loading

This commit is contained in:
faisolavolut 2025-02-25 14:14:03 +07:00
parent f1df9b4b08
commit 88dec0d087
1 changed files with 9 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import get from "lodash.get";
import { Checkbox } from "../ui/checkbox"; import { Checkbox } from "../ui/checkbox";
import { getNumber } from "@/lib/utils/getNumber"; import { getNumber } from "@/lib/utils/getNumber";
import { formatMoney } from "@/lib/components/form/field/TypeInput"; import { formatMoney } from "@/lib/components/form/field/TypeInput";
import { events } from "@/lib/utils/event";
export const TableList: React.FC<any> = ({ export const TableList: React.FC<any> = ({
autoPagination = true, autoPagination = true,
@ -71,6 +72,7 @@ export const TableList: React.FC<any> = ({
dataForm: [] as any[], dataForm: [] as any[],
listData: [] as any[], listData: [] as any[],
sort: {} as any, sort: {} as any,
filter: {} as any,
search: null as any, search: null as any,
paging: 1, paging: 1,
count: 0 as any, count: 0 as any,
@ -118,7 +120,13 @@ export const TableList: React.FC<any> = ({
); );
if (typeof onCount === "function") { 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.count = res;
local.render(); local.render();
} }