Create a table

To create a table, drag-and-drop the Table component from the components browser in the sidekick on the adaptive form. By default, the table contains two columns and three rows, including the header row.

Table component in AEM sidebar

About header and body cells

The header cells are text fields. To change the label for a header, right-click the header cell and click Edit. In the Edit dialog, update the label in the Value field and click OK.

The body cells are text boxes, by default. You can replace a body cell with any other adaptive forms component available in the sidekick, such as a numeric box, date picker, or drop-down list.

For example, the first body row in the following table includes text box, date picker, and drop-down list components as cells.

row-cell-types

You can merge two or more body cells by selecting the cells you want to merge, right-click, and select Merge. Also, you can split a merged cell by right-clicking it and selecting Split Cells.

Add, delete, move rows and columns

You can add and delete a row or column, and move a row up and down in a table.

Add, delete, or move a row

To add, delete, or move the row, click any cell of the row. open the content browser Content Browser and select the corresponding row, it highlights the selected row with the toolbar option from where you can add, delete, or move the row up or down.

  • The Move Up and Move Down operation moves the selected row up and down.

  • The Add Column operation adds a row below of the selected row.

  • The Delete Column operation deletes the selected row.

add-delete-move-row-column

Double-click the row to configure properties of a row, such as Name, Bind Reference, Repeat Settings, CSS Class.
add-delete-move-row-column

Add or delete a column

To add or delete a column, click the text cell in the header section, a toolbar opens with the options to add or delete a column:

add-delete-move-row-column

NOTE
While you can add any number of rows in a table, the maximum number of columns you can add is six. Also, you cannot delete the header row from the table.

Add table description

You can add a description of the table to explain how the information is organized that screen readers can interpret and read out. To add the description:

  1. Select the table and select cmppr to see its properties in the sidebar.
  2. Specify summary in the Accessibility tab.
  3. Click Done.

Sort columns in a table

You can sort data based on any column in a table in the adaptive form. The values in the column can be sorted in an ascending or descending order.

Sorting can be applied to table columns containing:

  • Static text
  • Data model object properties
  • Combination of static text and data model object properties

To apply sorting on table columns, the table column cells must contain any of the following components: Numeric Box, Numeric Stepper, Date Input Field, Date Picker, Text, or Text Box.

To enable sorting:

  1. Select the table and select configure_icon (Configure). You can also select the table using the Content browser in the sidekick of the Interactive Communication.

  2. Select Enable Sorting.

  3. Select done_icon to save the table properties. The sorting icons, up and down arrows, in columns headers represent that the sorting has been enabled.

    Enable sorting

  4. Switch to the Preview mode to view the output. The table is automatically sorted based on the first column of the table.

  5. Click the column header to sort the values based on the column.

    A column header with an up arrow represents that the table is sorted based on that column. In addition, the values in the column are displayed in the ascending order.

    Sorting in ascending order

    Similarly, a column header with a down arrow represents that the values in the column are displayed in the descending order.

    You can also make changes in the table in the Preview mode and click the column header again to sort the column values.

Set column width for a table

Execute the following steps to set column width for a table:

  1. In the Content tab, select the Table component and select the Configure ( Configure )icon.

1.Enter the comma-separated list of values in the Column Width field to specify the proportionate width of each column in the table. For example, for a table that includes 3 columns, specifying 2,4,6 as the value in the Column Width field results in setting the width of columns as 2/12 for first column, 4/12 for second column, and 6/12 for third column. 2/12 as the width for the first column refers to one-sixth of the table width. Similarly, 4/12 sets the second column width as one-third of the table width and 6/12 sets the third column width as half of the table width.

Configure table style

You can define the style for a table by using the Style mode in the page toolbar. Perform the following steps to switch to style mode and edit the table styling

  1. In the page toolbar, before Preview, select canvas-drop-down > Style.

  2. In the sidebar select table and select the edit button edit-button .
    You can see the styling properties in the sidebar.

Styling properties of a table

NOTE
You can change the color theme for header and body rows by changing the values of LESS variables. For more information, see Themes in AEM Forms.