diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index edea3b9ec7..bd04cadc4b 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -617,6 +617,7 @@ const getDeviceBindings = () => { /** * Gets all selected rows bindings for tables in the current asset. * TODO: remove in future because we don't need a separate store for this + * DEPRECATED */ const getSelectedRowsBindings = asset => { let bindings = [] @@ -632,8 +633,8 @@ const getSelectedRowsBindings = asset => { runtimeBinding: `${safeState}.${makePropSafe(table._id)}.${makePropSafe( "selectedRows" )}`, - readableBinding: `${table._instanceName}.Selected rows`, - category: "Selected rows", + readableBinding: `${table._instanceName}.Selected Row IDs (deprecated)`, + category: "Selected Row IDs (deprecated)", icon: "ViewRow", display: { name: table._instanceName }, })) @@ -649,8 +650,8 @@ const getSelectedRowsBindings = asset => { runtimeBinding: `${safeState}.${makePropSafe( block._id + "-table" )}.${makePropSafe("selectedRows")}`, - readableBinding: `${block._instanceName}.Selected rows`, - category: "Selected rows", + readableBinding: `${block._instanceName}.Selected Row IDs (deprecated)`, + category: "Selected Row IDs (deprecated)", icon: "ViewRow", display: { name: block._instanceName }, })) diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 64d9366423..6c7a254cfb 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -4719,10 +4719,22 @@ ] } ], - "context": { - "type": "schema", - "scope": "local" - } + "context": [ + { + "type": "schema", + "scope": "local" + }, + { + "type": "static", + "values": [ + { + "label": "Selected Rows", + "key": "selectedRows", + "type": "array" + } + ] + } + ] }, "daterangepicker": { "name": "Date Range", @@ -5610,37 +5622,50 @@ ] } ], - "context": { - "type": "static", - "suffix": "provider", - "values": [ - { - "label": "Rows", - "key": "rows", - "type": "array" - }, - { - "label": "Extra Info", - "key": "info", - "type": "string" - }, - { - "label": "Rows Length", - "key": "rowsLength", - "type": "number" - }, - { - "label": "Schema", - "key": "schema", - "type": "object" - }, - { - "label": "Page Number", - "key": "pageNumber", - "type": "number" - } - ] - } + "context": [ + { + "type": "static", + "suffix": "provider", + "values": [ + { + "label": "Rows", + "key": "rows", + "type": "array" + }, + { + "label": "Extra Info", + "key": "info", + "type": "string" + }, + { + "label": "Rows Length", + "key": "rowsLength", + "type": "number" + }, + { + "label": "Schema", + "key": "schema", + "type": "object" + }, + { + "label": "Page Number", + "key": "pageNumber", + "type": "number" + } + ] + }, + { + "type": "static", + "suffix": "table", + "values": [ + { + "label": "Selected Rows", + "key": "selectedRows", + "type": "array" + } + ] + } + ] }, "cardsblock": { "block": true, diff --git a/packages/client/src/components/app/table/Table.svelte b/packages/client/src/components/app/table/Table.svelte index 4da7dc314b..0afaff0a36 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 { canBeSortColumn } from "@budibase/shared-core" + import Provider from "../../context/Provider.svelte" export let dataProvider export let columns @@ -55,6 +56,11 @@ } } + // Build our data context + $: dataContext = { + selectedRows, + } + const getFields = ( schema, customColumns, @@ -156,27 +162,29 @@