From 8d2b5eede73c0b62da57acc2f508f332c7e60b86 Mon Sep 17 00:00:00 2001 From: Alexandre Rousseau Date: Thu, 19 Sep 2024 21:39:13 +0200 Subject: [PATCH] fix update table when searching in the dataframe --- src/ui/src/components/core/content/CoreDataframe.vue | 7 ++++++- .../core/content/CoreDataframe/useDataframeValueBroker.ts | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ui/src/components/core/content/CoreDataframe.vue b/src/ui/src/components/core/content/CoreDataframe.vue index 2fa5de0b7..cecd7836d 100644 --- a/src/ui/src/components/core/content/CoreDataframe.vue +++ b/src/ui/src/components/core/content/CoreDataframe.vue @@ -560,7 +560,12 @@ async function handleSearchChange(ev: InputEvent) { columnNames .map((c) => `aq.op.match(d.${c}, $.pattern) !== null`) .join(" || "); - table.value = baseTable.params({ pattern, filterS }).filter(filterS); + + const aq = await import("arquero"); + table.value = baseTable + .params({ pattern, filterS }) + .filter(filterS) + .derive({ [ARQUERO_INTERNAL_ID]: () => aq.op.row_number() }); } await nextTick(); resetScroll(); diff --git a/src/ui/src/components/core/content/CoreDataframe/useDataframeValueBroker.ts b/src/ui/src/components/core/content/CoreDataframe/useDataframeValueBroker.ts index d9d99a224..c87aac6de 100644 --- a/src/ui/src/components/core/content/CoreDataframe/useDataframeValueBroker.ts +++ b/src/ui/src/components/core/content/CoreDataframe/useDataframeValueBroker.ts @@ -109,6 +109,8 @@ export function useDataFrameValueBroker( value: unknown, ) { if (!table.value) throw Error("Table is not ready"); + if (rowIndex === undefined) + throw Error("Must specify the index to update a row"); const eventType = "wf-dataframe-update"; const rowIndexBackend = rowIndex - 1; // 0-based index (arquero is based on 1-based index)