Wiki

Clone wiki

adf-builder-java / node-table

Node: table

Description

A container for the nodes that define a table.

Example

Java

table()
        .tr(th(" Row one, cell one"))
        .tr(td("Row one, cell two"));

ADF

{
  "type": "table",
  "attrs": {
    "localId": "table-id"
  },
  "content": [
    {
      "type": "tableRow",
      "content": [
        {
          "type": "tableHeader",
          "content": [
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": " Row one, cell one"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "type": "tableRow",
      "content": [
        {
          "type": "tableCell",
          "content": [
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "Row one, cell two"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

Result

Row one, cell one
Row one, cell two

Compatibility

Products

Confluence Jira
⚠️1

Usage

Marks

Structure

  • type - table
  • attrs?
    • isNumberColumnEnabled? 1 - boolean
    • width? 1 - a positive integer
    • layout? 2 - wide | full-width | center | align-end | align-start | default
    • localId? - string (not empty) (likely to be a UUID, but this is not enforced)
    • displayMode? 3default | fixed
  • content - array(tableRow...) (at least 1)
Column Count Minimum Width Maximum Width
1 48 1800
2 96 1800
3+ 144 1800

  1. width sets the width (in pixels) of the table on the page. This value is independent of the table's column width, which allows control of the table's overflow. This supersedes the existing layout attribute and will be used instead of it at runtime. If width is not provided the editor will convert layout to pixels (default=760, wide=960 and full-width=1800). Although no minimum and maximum width is enforced, it is recommended to follow these guidelines in the table above. None of these settings apply to Jira, where all tables are automatically displayed across the full width of the text container. 

  2. Although the layout setting is mostly superseded by the width setting, the layout is still significant when it is set to center or align-start. The center option aligns the table to the center of the page, and align-start option aligns the table to the left. In both of these cases, the width cannot exceed the width of the page. Other layout values will be converted to width settings as described above. 

  3. The displayMode controls how tables adapt to narrow screens. By default, columns will shrink up to 40% of their nominal size to accommodate a narrow screen. When the displayMode is set to fixed, the columns will preserve their original width regardless of screen size, forcing the user interface to handle this in some other way, such as by providing a scrollbar. 

Updated