All articles

Tables & data

Show items under a table row

Some rows carry a list of their own: a product bundle lists its components, a project phase lists its tasks. Sub-rows print that list directly beneath its row, in the same table, using the same columns and the same header row. The reader sees one continuous table instead of a table followed by a pile of smaller ones.

Each set of sub-rows is a sub-level. The first sub-level prints under every row of the table, a second sub-level prints under every first-level sub-row, and so on, down to five levels.

Before you start

  • In the hosted app, changing a template needs the editor role or higher (roles run viewer, editor, admin, owner). Local mode is single-user and has no roles.
  • You need a table whose rows each hold a list in your data, such as line items that each have a Components list. Load sample or live data that includes it, so you can see the result.
  • A table can have sub-rows or be grouped, not both. If this table is grouped, remove its grouping levels first.
  • While you are reviewing changes Buddy proposed, the properties panel is paused until you accept or discard them.

Add a sub-level

  1. Select the table — click it on the canvas in the Flow view, or its row in the Outline — and open the properties panel with the button at the far right of the app bar (tooltip Show properties panel). ⌘. (Ctrl+. on Windows) works too.
  2. Find the Sub-rows line, which reads · none, and press + Add sub-level on it. A Sub-level 1 card appears.
  3. In Source (a list in item), replace the starting value, item.Items, with the list each row holds, such as item.Components. If you gave the table its own Binding name, the label and the path use that name instead of item.
  4. Below the source is one cell per column, each named after its column's header. Open a cell and add runs, as described next.

A cell you leave empty prints empty. A row whose list is empty or missing prints no sub-rows.

Fill the sub-row cells

Sub-row cells are built from the same runs as any table cell: + Text, + Field, + Formula, + Page # and + Page count. As you type a field path, three names are suggested:

NameWhat it means in a sub-row cell
itemthe sub-row's own entry in the list, such as one component
indexits position in that list, counting from 0
parentthe row one level up — for the first sub-level, the table row

Type the rest of the path after the name, such as item.Name or parent.Product. For a bundle table, for example:

  1. In the Product column's cell, press + Field and enter item.Name.
  2. In the Quantity column's cell, press + Field and enter item.Quantity. Or use + Formula to multiply item.Quantity by parent.Quantity, showing how many of each component the whole line needs.
  3. Leave the price columns' cells empty, so only the bundle row shows a price.

Each run has the usual ⋯ options, including its format — see Format values. To number the components 1, 2, 3, use a formula of index + 1 — see Formulas.

Add a deeper level

Press + Add sub-level again for Sub-level 2. Its Source is a list inside each first-level sub-row's item — for example item.Parts for each component's parts. In its cells, item is the part and parent is the component.

parent reaches exactly one level up. To show the table row's own fields at the second level, give the table a Binding name, such as line, in its Source section, and use that name: line.Product. Naming the binding does not rewrite any paths: change item to the new name yourself in the table's own cells and totals and in the first sub-level's Source. Inside sub-row cells, item still means the sub-row's own entry.

A table can have up to five sub-levels. After the fifth, + Add sub-level is unavailable and its tooltip reads Maximum 5 levels.

Remove a level

Press ✕ on a sub-level card. That level and every level below it are removed together. ⌘Z (Ctrl+Z on Windows) brings them back.

When you add, remove, duplicate or move a column, Weft makes the same change to the cells of every sub-level, so sub-row content stays under the right header.

How sub-rows print

  • Sub-rows print in muted grey beneath their row, with the first cell indented further at each level.
  • They use the columns' widths, alignment and fill.
  • They are never striped, and they do not shift the stripe pattern of the main rows.
  • A column's conditional formatting, including Show cell only when a condition is met, applies to the main rows only.
  • The header row repeats on every page. A single sub-row never splits, but a page break can fall between a row and its sub-rows.
  • A column's Footer / total adds up the table's main rows, not the sub-rows.

Good to know

  • While a table is grouped, + Add sub-level is unavailable, and opening Sub-rows shows Sub-rows are not available while this table is grouped (remove grouping first).
  • The Source box does not check your path as you type. If it does not lead to a list, no sub-rows print.
  • A field in a sub-row cell that does not exist in the loaded data can be flagged on the canvas and in the notices dock, like other fields, when the sample has sub-rows to check it against.
  • The check before export may report a sub-level as This list is empty for some rows (or This list will be empty). That is expected when not every row has items of its own.
  • Sub-row text is edited in the properties panel, not on the canvas.

What next