From 027c63fd842309d989f23b328d2e3de416b1cf38 Mon Sep 17 00:00:00 2001 From: Aurora Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Sat, 15 Oct 2022 14:25:49 +0300 Subject: [PATCH] Trigger window resize on datatable changes - Also removed extension table pagination Previous and Next buttons to avoid overflowing if card is not wide enough Affects issues: - Possibly fixed #2637 --- .../dashboard/src/components/extensions/ExtensionTable.js | 1 + Plan/react/dashboard/src/components/table/DataTablesTable.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Plan/react/dashboard/src/components/extensions/ExtensionTable.js b/Plan/react/dashboard/src/components/extensions/ExtensionTable.js index ac6381d22..a0e01ec9c 100644 --- a/Plan/react/dashboard/src/components/extensions/ExtensionTable.js +++ b/Plan/react/dashboard/src/components/extensions/ExtensionTable.js @@ -31,6 +31,7 @@ const ExtensionDataTable = ({table}) => { deferRender: true, columns: data.columns, data: data.data, + pagingType: "numbers", order: [[1, "desc"]] } return ( diff --git a/Plan/react/dashboard/src/components/table/DataTablesTable.js b/Plan/react/dashboard/src/components/table/DataTablesTable.js index bd3cd0589..b308108a3 100644 --- a/Plan/react/dashboard/src/components/table/DataTablesTable.js +++ b/Plan/react/dashboard/src/components/table/DataTablesTable.js @@ -17,6 +17,10 @@ const DataTablesTable = ({id, options}) => { } dataTableRef.current = new DataTable(idSelector, options); + // https://github.com/plan-player-analytics/Plan/issues/2637 + const triggerResize = () => window.dispatchEvent(new Event('resize')); + dataTableRef.current.on('length.dt', triggerResize); + dataTableRef.current.on('search.dt', triggerResize); return () => { if (dataTableRef.current) {