From d888831b4a0b4f5d863e3d7242c0547aa470b4b3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 24 Feb 2022 09:15:37 +0000 Subject: [PATCH] Fix table selection defaulting to true, reset selected rows when unmounting tables, remove position absolute on row selection text --- .../src/components/app/table/Table.svelte | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/client/src/components/app/table/Table.svelte b/packages/client/src/components/app/table/Table.svelte index 6d04597978..f5f591688f 100644 --- a/packages/client/src/components/app/table/Table.svelte +++ b/packages/client/src/components/app/table/Table.svelte @@ -3,6 +3,7 @@ import { Table } from "@budibase/bbui" import SlotRenderer from "./SlotRenderer.svelte" import { UnsortableTypes } from "../../../constants" + import { onDestroy } from "svelte" export let dataProvider export let columns @@ -38,13 +39,13 @@ dataProvider?.id, ActionTypes.SetDataProviderSorting ) - $: { rowSelectionStore.actions.updateSelection( $component.id, selectedRows.map(row => row._id) ) } + const getFields = (schema, customColumns, showAutoColumns) => { // Check for an invalid column selection let invalid = false @@ -125,6 +126,10 @@ const split = linkURL.split("/:") routeStore.actions.navigate(`${split[0]}/${id}`, linkPeek) } + + onDestroy(() => { + rowSelectionStore.actions.updateSelection($component.id, []) + })
@@ -136,7 +141,7 @@ {quiet} {compact} {customRenderers} - {allowSelectRows} + allowSelectRows={!!allowSelectRows} bind:selectedRows allowEditRows={false} allowEditColumns={false} @@ -148,8 +153,10 @@ > - {#if allowSelectRows} -
{selectedRows.length} record(s) selected
+ {#if allowSelectRows && selectedRows.length} +
+ {selectedRows.length} row{selectedRows.length === 1 ? "" : "s"} selected +
{/if}
@@ -159,7 +166,6 @@ } .row-count { - margin-top: calc(1.4 * var(--spacing-xl)); - position: absolute; + margin-top: var(--spacing-l); }