From 246b1a80fe15a9e2bde031c096d4f3e01d33e525 Mon Sep 17 00:00:00 2001 From: faisolavolut Date: Mon, 28 Apr 2025 11:46:57 +0700 Subject: [PATCH] fix: update column handling in TableList to support function-based column definitions --- components/tablelist/TableList.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/tablelist/TableList.tsx b/components/tablelist/TableList.tsx index aa91c7e..f9b4d8e 100644 --- a/components/tablelist/TableList.tsx +++ b/components/tablelist/TableList.tsx @@ -323,13 +323,14 @@ export const TableList = ({ }; useEffect(() => { try { - if (Array.isArray(column) && column?.length) { - const dateIndices = Array.isArray(column) - ? column + const col = typeof column === "function" ? column() : column; + if (Array.isArray(col) && col?.length) { + const dateIndices = Array.isArray(col) + ? col .map((e, index) => (e.type === "date" ? index : -1)) .filter((index) => index !== -1) : []; - const result: FieldFilterProps[] = column + const result: FieldFilterProps[] = col .filter( (e, index) => e.filter !== false && @@ -362,6 +363,7 @@ export const TableList = ({ pagination: e?.pagination, search: e?.search, })); + console.log({ result }); local.fieldFilter = result; local.render(); }