Refresh sql columns on defining relationships
This commit is contained in:
parent
90c8ae9ed3
commit
faa1c27d29
2 changed files with 17 additions and 1 deletions
|
@ -136,6 +136,7 @@
|
||||||
const onUpdateColumns = () => {
|
const onUpdateColumns = () => {
|
||||||
selectedRows = []
|
selectedRows = []
|
||||||
fetch.refresh()
|
fetch.refresh()
|
||||||
|
tables.fetchTable(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch data whenever rows are modified. Unfortunately we have to lose
|
// Fetch data whenever rows are modified. Unfortunately we have to lose
|
||||||
|
@ -148,8 +149,10 @@
|
||||||
// When importing new rows it is better to reinitialise request/paging data.
|
// When importing new rows it is better to reinitialise request/paging data.
|
||||||
// Not doing so causes inconsistency in paging behaviour and content.
|
// Not doing so causes inconsistency in paging behaviour and content.
|
||||||
const onImportData = () => {
|
const onImportData = () => {
|
||||||
fetch.getInitialData()
|
fetch.getInitialData(enrichedSchema)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: console.log(enrichedSchema)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -22,6 +22,18 @@ export function createTablesStore() {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fetchTable = async tableId => {
|
||||||
|
const table = await API.fetchTableDefinition(tableId)
|
||||||
|
|
||||||
|
store.update(state => {
|
||||||
|
const indexToUpdate = state.list.findIndex(t => t._id === table._id)
|
||||||
|
state.list[indexToUpdate] = table
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const select = tableId => {
|
const select = tableId => {
|
||||||
store.update(state => ({
|
store.update(state => ({
|
||||||
...state,
|
...state,
|
||||||
|
@ -126,6 +138,7 @@ export function createTablesStore() {
|
||||||
return {
|
return {
|
||||||
subscribe: derivedStore.subscribe,
|
subscribe: derivedStore.subscribe,
|
||||||
fetch,
|
fetch,
|
||||||
|
fetchTable,
|
||||||
init: fetch,
|
init: fetch,
|
||||||
select,
|
select,
|
||||||
save,
|
save,
|
||||||
|
|
Loading…
Reference in a new issue