Browse Source

Merge pull request #9793 from nocodb/nc-fix-emit-event-from-infinite-table

fix(extensions): url-preview: emit event from `<InfiniteTable/>`
pull/9796/head
Aman Desai 2 weeks ago committed by GitHub
parent
commit
609f3f4492
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 13
      packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue

13
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<number>()
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

Loading…
Cancel
Save