dataset().scriptTagAsync()

.dataset(...).scriptTagAsync(
  style: IStyleFramework = 'd'
): Promise<string>

Get a <script> tag for a specific dataset to be displayed as a table. Insert this script tag where you want the table to appear in your HTML. This is the same as scriptTag, but it will retrieve the secure access token for you - thus requiring it to be async.

Parameters

  • dataset string
    ID (UUID) of the dataset to be shown
  • style string
    The styling framework to use for this table. Can be one of:
    • d - Default
    • auto - Auto detect
    • bs - Bootstrap 3
    • bs4 - Bootstrap 4
    • bs5 - Bootstrap 5
    • dt - CloudTables / DataTables default styling
    • zf - Zurb Foundation
    • ju - jQuery UI
    • se - Semantic UI
    • no - No styling

Returns

This method a Promise which will resolve to a string which contains the HTML <script> tag to use to embed your CloudTable.

Example

const api = new CloudTablesApi('sub-domain', ':apiKey');

let result = await api.dataset(':id').scriptTag();

Will result in a string such as:

<script
  src="https://sub-domain.{domain}/loader/:id/table/d"
  data-token="ANnbgUJoKO8qh5fYObpffdNqqgANtVVL"
></script>