From d453914d4b4a8d5219e2253e2896245f98c88115 Mon Sep 17 00:00:00 2001 From: amandesai01 Date: Mon, 11 Nov 2024 09:12:45 +0000 Subject: [PATCH] fix(extensions): url-preview: emit event from `` --- .../components/smartsheet/grid/InfiniteTable.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue b/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue index d79aa56ce2..4d18dcc863 100644 --- a/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue +++ b/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue @@ -258,7 +258,7 @@ const updateVisibleRows = async () => { const firstChunkId = Math.floor(start / CHUNK_SIZE) const lastChunkId = Math.floor((end - 1) / CHUNK_SIZE) - const chunksToFetch = new Set() + const chunksToFetch = new Set() for (let chunkId = firstChunkId; chunkId <= lastChunkId; chunkId++) { if (!chunkStates.value[chunkId]) chunksToFetch.add(chunkId) @@ -1399,6 +1399,17 @@ eventBus.on(async (event, payload) => { } }) +watch(activeCell, (activeCell) => { + const row = activeCell.row !== null ? cachedRows.value.get(activeCell.row)?.row : undefined; + const col = (row && activeCell.col !== null) ? fields.value[activeCell.col] : undefined; + const val = (row && col) ? row[col.title as string] : undefined; + + const rowId = extractPkFromRow(row!, meta.value?.columns as ColumnType[]) + const viewId = view.value?.id; + + eventBus.emit(SmartsheetStoreEvents.CELL_SELECTED, { rowId, colId: col?.id, val, viewId }); +}) + const reloadViewDataHookHandler = async () => { // If the scroll Position is not at the top, scroll to the top // This always loads the first page of data when the view data is reloaded