1
0
Fork 0
mirror of synced 2024-09-10 22:46:09 +12:00
This commit is contained in:
Adria Navarro 2023-07-19 11:06:59 +02:00
parent a9cb838847
commit 16764e6634
2 changed files with 32 additions and 4 deletions

View file

@ -0,0 +1,28 @@
<script>
import { views } from "stores/backend"
import { syncURLToState } from "helpers/urlStateSync"
import * as routify from "@roxi/routify"
import { onDestroy } from "svelte"
import { store } from "builderStore"
$: viewName = $views.selectedViewName
$: store.actions.websocket.selectResource(viewName)
const stopSyncing = syncURLToState({
urlParam: "id",
stateKey: "selectedViewId",
validate: id => $views.list?.some(view => view._id === id),
update: id => {
const view = $views.list.find(v => v._id === id)
views.select(view.name)
},
fallbackUrl: "../",
store: views,
routify,
decode: decodeURIComponent,
})
onDestroy(stopSyncing)
</script>
<slot />

View file

@ -1,15 +1,15 @@
<script>
import { views } from "stores/backend"
import { Grid } from "@budibase/frontend-core"
import { API } from "api"
import { Grid } from "@budibase/frontend-core"
import { views } from "stores/backend"
export let id
$: selectedView = $views.selected
</script>
<div class="wrapper">
<Grid
{API}
tableId={id}
tableId={selectedView?._id}
datasourceType="viewV2"
showAvatars={false}
showControls={false}