Dynamic table

In invoice templates, a Dynamic Table is an essential element. A Dynamic Table is different from a standard table in that it has a variable number of rows. In a Print context it will automatically overflow into as many pages as necessary to output all rows and it can display a transport line.

Dynamic Tables are only available when the loaded record set or Data Mapping Configuration contains transactional data in one or more detail tables (see Loading data).

Creating a Dynamic Table

To create a Dynamic Table:

  1. Open the Insert Detail Table dialog. There are several ways to do that:
    • Drag the data field that contains the name of the detail table into the template.
    • On the menu select Insert > Table > Dynamic.
    • On the toolbar, click the Insert detail table button.
  2. Enter the table's desired attributes:
    • ID: A unique identifier for the table. IDs are used to access the table from scripts and as CSS selectors for style rules.
    • Class: A class identifier for the table. Classes can be shared between elements and are used to access the table from scripts and as CSS selectors for style rules.
    • Detail Table: Use the drop-down to select which detail table to display within the dynamic table.
    • Width: Enter the width of the table.

    A Dynamic Table is always inserted at the cursor position.

  3. Click Next and select which fields should show up in the Dynamic Table.

    The order of the fields indicates in which order columns are displayed in the dynamic table, from left to right. Select a line and then use the Up and Down buttons to change the order of the columns.

    You could change the placeholder for each data field as well; just click a placeholder to edit it.

  4. Click Next and check Calculate Subtotals to enable the options for a (sub)total at the end and (in Print sections) transport lines. The options are:

    • Column: Use the drop-down list to select the field that contains the currency value to be used to calculate the subtotal of the table. This field generally contains the result of item prices multiplied by the quantity.
    • Field name: Type the name to display in the footer when displaying that page's subtotal.
    • Show in footer: Check to display the subtotal in the footer of the table at the bottom of each page and at the end of the table.
    • Show in header (transportline): Check to display the subtotal of the previous page at the top of the table.
  5. Click Next and select the styling attributes. Use the drop-down to select the desired table style. Choose No Style if you want to style the table yourself.

  6. Click Finish to add the table to the section.

When a Dynamic Table is added, a script is created for each of the columns containing a placeholder for a field that is to be replaced. These scripts are placed inside a folder named after the table's ID, on the Scripts pane.

Adding a row at the bottom or the top of a Dynamic Table

Sometimes you'll want to add one or more rows to the header or footer of a Dynamic Table: to add taxes and/or the total of the invoice to the table, for example, or to add a custom message. A header or footer row can be added to a Dynamic Table as follows:

  1. In the workspace, open the Design tab. Right-click the first line of the table if you want to add a header row, or the last line if you want to add a footer row.
  2. On the shortcut menu select Row > Insert below or Insert above. The new row will be added to either the header or footer.
  3. Right-click the row and choose Row > Show. Now you have the following options:
    • A header row marked as a Transport line will not appear at the very top of the table, but only on following pages if the table gets split over multiple pages. Note that only the first row that is marked as Transport line will be taken into account. To make a header row appear at the start of the table and on following pages, make sure that it is not marked as Transport line.
    • A footer row can appear before each page break (Before page break), if the table gets split over multiple pages, or only at the end of the table (At end of table), or before each page break and at the end (Always).

You can fill additional rows as usual. You could for example drag a data field to the new row (see Variable Data) or type in the cells.

Examples

For a few examples of how to adjust the default subtotals footer and (transport line) header, see the following how-to: Custom table overflow footers.

Styling a Dynamic Table

The Insert Detail Table wizard lets you select a style, but if you want to apply a different style to the table, choose No Style when creating the table. Then the style of a Dynamic Table is completely customizable: you can change the font, font size and color, the borders, the cell padding (the distance between the edge of the cell and its content), and the background color or image of the table and its cells. See Styling a table.

When generating output from a template, a Dynamic Table is created slightly faster when it's styled via Cascading Style Sheets than when it's styled with local formatting. Therefore the preferred way to style a dynamic table is via style sheets.

Change detail line formatting based upon a data field value

An example of how to change the formatting of a line in a Dynamic Table, based upon a data field value, is given in the following how-to: Change detail line formatting based upon a data field value.

Resizing a Dynamic Table

To change the width of a Dynamic Table or of a column in a Dynamic Table, select it (see Selecting an element) and type the desired width as a percentage in the respective field on the Attributes pane.

The height of the Dynamic Table is adjusted automatically to the amount of data added to it in Preview mode or when generating output.

It is however possible to change the height of the rows: click in the row and type the desired height in the respective field on the Attributes pane. All line item rows will have the same height.

HTML elements and attributes

In HTML, a Detail Table is just a normal <table> element with rows and cells (see HTML element: table). But apart from the native attributes of a table, row and cell element, some data- attributes can be seen in detail tables:

  • data-detail: The name of the detail table in the data, for example: data-detail="products".
  • data-repeat: The row will be repeated if it has this attribute: data-repeat="".
  • data-showin: This attribute determines the visibility of the row in different situations, if the table gets split over multiple pages:
    • header will make the row show up at the top of the table on the first page only.
    • footer will make the row show up in the footer of the table on the last page only.
    • break used in a row in the <thead> section of a table indicates that the row should not be displayed at the top of the table on the first page, but only on following pages. Used on a row in the <tfoot> section, it indicates that the row should be displayed before each page-break. This value may be combined with footer or header, for example: data-showin="footer, break", to make the row show up on every page.
    Note that these options can also be set via the user interface: right-click on the row and select Row > Show; see Adding a row at the bottom or the top of a Dynamic Table.
  • data-breakable: this attribute is added to every copied row (in preview mode or when creating output). It is required by the pagination routines of Connect to split the table across pages.
  • data-column-resize, if present, indicates that the columns may be resized (data-column-resize="").​
 
  • Last Topic Update: 24/01/2017 09:32
  • Last Published: 7/6/2017 : 9:49 AM