Browse Source

feat(nc-gui): load field query when view is changed

pull/4473/head
Wing-Kam Wong 2 years ago
parent
commit
ce009649fb
  1. 27
      packages/nc-gui/components/smartsheet/toolbar/SearchData.vue

27
packages/nc-gui/components/smartsheet/toolbar/SearchData.vue

@ -1,9 +1,22 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ReloadViewDataHookInj, computed, inject, onClickOutside, ref, useSmartsheetStoreOrThrow } from '#imports' import {
ActiveViewInj,
ReloadViewDataHookInj,
computed,
inject,
onClickOutside,
ref,
useFieldQuery,
useSmartsheetStoreOrThrow,
} from '#imports'
const reloadData = inject(ReloadViewDataHookInj)! const reloadData = inject(ReloadViewDataHookInj)!
const { search, meta } = useSmartsheetStoreOrThrow() const { meta } = useSmartsheetStoreOrThrow()
const activeView = inject(ActiveViewInj, ref())
const { search, loadFieldQuery } = useFieldQuery(activeView)
const isDropdownOpen = ref(false) const isDropdownOpen = ref(false)
@ -18,6 +31,16 @@ const columns = computed(() =>
})), })),
) )
watch(
() => activeView.value?.id,
(n, o) => {
if (n !== o) {
loadFieldQuery(activeView)
}
},
{ immediate: true },
)
function onPressEnter() { function onPressEnter() {
reloadData.trigger() reloadData.trigger()
} }

Loading…
Cancel
Save