Browse Source

Merge pull request #3786 from nocodb/fix/3784-gallery-view-bugs

Fix(gui):  Gallery view bugs
pull/3791/head
Pranav C 2 years ago committed by GitHub
parent
commit
e65bb785bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      packages/nc-gui/components/smartsheet/Gallery.vue

10
packages/nc-gui/components/smartsheet/Gallery.vue

@ -12,6 +12,7 @@ import {
OpenNewRecordFormHookInj, OpenNewRecordFormHookInj,
PaginationDataInj, PaginationDataInj,
ReadonlyInj, ReadonlyInj,
ReloadRowDataHookInj,
ReloadViewMetaHookInj, ReloadViewMetaHookInj,
extractPkFromRow, extractPkFromRow,
inject, inject,
@ -29,6 +30,7 @@ interface Attachment {
const meta = inject(MetaInj, ref()) const meta = inject(MetaInj, ref())
const view = inject(ActiveViewInj, ref()) const view = inject(ActiveViewInj, ref())
const reloadViewMetaHook = inject(ReloadViewMetaHookInj) const reloadViewMetaHook = inject(ReloadViewMetaHookInj)
const reloadViewDataHook = inject(ReloadViewDataHookInj)
const openNewRecordFormHook = inject(OpenNewRecordFormHookInj, createEventHook()) const openNewRecordFormHook = inject(OpenNewRecordFormHookInj, createEventHook())
const expandedFormDlg = ref(false) const expandedFormDlg = ref(false)
@ -85,7 +87,7 @@ const attachments = (record: any): Array<Attachment> => {
} }
} }
const expandForm = (row: RowType, _state?: Record<string, any>) => { const expandForm = (row: RowType, state?: Record<string, any>) => {
if (!isUIAllowed('xcDatatableEditable')) return if (!isUIAllowed('xcDatatableEditable')) return
const rowId = extractPkFromRow(row.row, meta.value.columns) const rowId = extractPkFromRow(row.row, meta.value.columns)
@ -140,11 +142,17 @@ reloadViewMetaHook?.on(async () => {
reloadAttachments.value = false reloadAttachments.value = false
}) })
}) })
reloadViewDataHook?.on(async () => {
await loadData()
})
onMounted(async () => { onMounted(async () => {
await loadData() await loadData()
await loadGalleryData() await loadGalleryData()
}) })
// provide view data reload hook as fallback to row data reload
provide(ReloadRowDataHookInj, reloadViewDataHook)
</script> </script>
<template> <template>

Loading…
Cancel
Save