Reset data ui searches when mutating rows as we cannot guarantee that bookmarks are the same

This commit is contained in:
Andrew Kingston 2021-09-30 13:49:09 +01:00
parent 44a3390200
commit 7f08ef3a6c
1 changed files with 8 additions and 2 deletions

View File

@ -56,6 +56,12 @@
schema, schema,
}) })
} }
// Fetch data whenever rows are modified. Unfortunately we have to lose
// our pagination place, as our bookmarks will have shifted.
const onUpdateRows = () => {
search.update()
}
</script> </script>
<div> <div>
@ -71,7 +77,7 @@
allowEditing allowEditing
disableSorting disableSorting
on:updatecolumns={onUpdateColumns} on:updatecolumns={onUpdateColumns}
on:updaterows={search.refresh} on:updaterows={onUpdateRows}
> >
{#if isInternal} {#if isInternal}
<CreateColumnButton on:updatecolumns={onUpdateColumns} /> <CreateColumnButton on:updatecolumns={onUpdateColumns} />
@ -79,7 +85,7 @@
{#if schema && Object.keys(schema).length > 0} {#if schema && Object.keys(schema).length > 0}
{#if !isUsersTable} {#if !isUsersTable}
<CreateRowButton <CreateRowButton
on:updaterows={search.refresh} on:updaterows={onUpdateRows}
title={"Create row"} title={"Create row"}
modalContentComponent={CreateEditRow} modalContentComponent={CreateEditRow}
/> />