1
0
Fork 0
mirror of synced 2024-06-30 03:50:37 +12:00

Add hot reloading to search results

This commit is contained in:
Andrew Kingston 2021-02-11 09:30:05 +00:00
parent b5e78fe14a
commit f5fe4c9bb7

View file

@ -1,6 +1,5 @@
<script>
import { getContext } from "svelte"
import { isEmpty } from "lodash/fp"
import {
Button,
DatePicker,
@ -10,10 +9,12 @@
Input,
} from "@budibase/bbui"
const { API, styleable, Provider, builderStore } = getContext("sdk")
const { API, styleable, Provider, builderStore, ActionTypes } = getContext(
"sdk"
)
const component = getContext("component")
export let table = []
export let table
export let columns = []
export let pageSize
export let noRowsMessage
@ -34,9 +35,16 @@
search[next] === "" ? acc : { ...acc, [next]: search[next] },
{}
)
$: actions = [
{
type: ActionTypes.RefreshDatasource,
callback: () => fetchData(table, page),
metadata: { datasource: { type: "table", tableId: table } },
},
]
async function fetchData(table, page) {
if (!isEmpty(table)) {
if (table) {
const tableDef = await API.fetchTableDefinition(table)
schema = tableDef.schema
rows = await API.searchTableData({
@ -60,6 +68,7 @@
}
</script>
<Provider {actions}>
<div use:styleable={$component.styles}>
<div class="query-builder">
{#if schema}
@ -128,6 +137,7 @@
{/if}
</div>
</div>
</Provider>
<style>
p {