solving initial table load issue

This commit is contained in:
Martin McKeaveney 2020-03-23 10:43:34 +00:00
parent e772283914
commit e073d30e44
3 changed files with 79 additions and 80 deletions

View File

@ -76,7 +76,11 @@
</ActionButton> </ActionButton>
{/if} {/if}
</div> </div>
{#if $backendUiStore.selectedDatabase.id}
<ModelDataTable {selectRecord} /> <ModelDataTable {selectRecord} />
{:else}
Please select a database
{/if}
</div> </div>
</div> </div>

View File

@ -21,7 +21,7 @@
$: views = $store.hierarchy.indexes $: views = $store.hierarchy.indexes
$: currentAppInfo = { $: currentAppInfo = {
appname: $store.appname, appname: $store.appname,
instanceId: $backendUiStore.selectedDatabase.id instanceId: $backendUiStore.selectedDatabase.id,
} }
$: data = $backendUiStore.selectedView.records.slice( $: data = $backendUiStore.selectedView.records.slice(
currentPage * ITEMS_PER_PAGE, currentPage * ITEMS_PER_PAGE,
@ -43,16 +43,17 @@
} }
onMount(async () => { onMount(async () => {
if (showTable) { if (views.length > 0) {
await fetchRecordsForView(views[0].name, currentAppInfo) await fetchRecordsForView(views[0].name, currentAppInfo)
} }
}) })
</script> </script>
{#if showTable} <section>
<section>
<div class="table-controls"> <div class="table-controls">
<h4 class="budibase__title--3">{$backendUiStore.selectedDatabase.name || ""}</h4> <h4 class="budibase__title--3">
{$backendUiStore.selectedDatabase.name || ''}
</h4>
<Select <Select
icon="ri-eye-line" icon="ri-eye-line"
on:change={e => fetchRecordsForView(e.target.value)}> on:change={e => fetchRecordsForView(e.target.value)}>
@ -82,12 +83,7 @@
<div uk-dropdown="mode: click"> <div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav"> <ul class="uk-nav uk-dropdown-nav">
<li> <li>
<div <div on:click={async () => {}}>View</div>
on:click={async () => {
// fetch the child records for that particular row
}}>
View
</div>
</li> </li>
<li <li
on:click={() => { on:click={() => {
@ -124,12 +120,11 @@
{/each} {/each}
</tbody> </tbody>
</table> </table>
<TablePagination bind:currentPage pageItemCount={data.length} {ITEMS_PER_PAGE} /> <TablePagination
</section> bind:currentPage
{:else} pageItemCount={data.length}
Please select a database. {ITEMS_PER_PAGE} />
{/if} </section>
<style> <style>
table { table {

View File

@ -49,9 +49,9 @@
<UsersList /> <UsersList />
</div> </div>
<NavItem name="ACCESS_LEVELS" label="User Levels" />
</div> </div>
{/if} {/if}
<NavItem name="ACCESS_LEVELS" label="User Levels" />
</div> </div>
<style> <style>