From e85bd4abe1fd25cf8b6603c2a25b8ee9f6962ce9 Mon Sep 17 00:00:00 2001 From: rizky Date: Thu, 15 Aug 2024 20:15:16 -0700 Subject: [PATCH] fix paging --- comps/list/TableList.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/comps/list/TableList.tsx b/comps/list/TableList.tsx index 83b543c..ccae909 100755 --- a/comps/list/TableList.tsx +++ b/comps/list/TableList.tsx @@ -36,7 +36,6 @@ import { MDLocal } from "../md/utils/typings"; import { Skeleton } from "../ui/skeleton"; import { toast } from "../ui/toast"; import { sortTree } from "./utils/sort-tree"; -import { getPathname } from "lib/exports"; type OnRowClick = (arg: { row: any; @@ -79,6 +78,7 @@ type TableListProp = { softdel_field?: string; gen_table?: string; softdel_type?: string; + paging?:boolean; cache_row?: boolean; md?: MDLocal; }; @@ -111,6 +111,7 @@ export const TableList: FC = ({ render_col, show_header, value, + paging, cache_row, __props, md, @@ -256,7 +257,7 @@ export const TableList: FC = ({ } const result = on_load({ ...load_args, mode: "query" }); const callback = (data: any[]) => { - if (local.paging.skip === 0) { + if (local.paging.skip === 0 || (paging !== undefined || paging)) { local.data = data; } else { local.data = [...local.data, ...data]; @@ -265,9 +266,10 @@ export const TableList: FC = ({ local.status = "ready"; local.reloading = null; local.render(); + done(); - if (local.grid_ref && !id_parent) + if (local.grid_ref && !id_parent && (paging !== undefined || paging)) local.paging.scroll(local.grid_ref); }; @@ -769,9 +771,11 @@ export const TableList: FC = ({ const toaster_el = document.getElementsByClassName("prasi-toaster")[0]; if (mode === "table") { + console.log("ama",local.status, data.length); if (local.status === "resizing" && !isEditor) { local.status = "ready"; local.render(); + return null; } return (