Data Table

Building in the WCMS

Overview

As explained on the Best Practices page for data tables, the WCMS supports two types of table builders.  The instructions for both the Visual Composer table tool and the WYSIWYG table tool are provided below.

Creating a Visual Composer Data Table

To use the data table element in Visual Composer, you need to import a data file in CSV or JSON format.  The first record or row must contain the column headers.  (Row headers are not supported at this time.)

Based on the table settings, the WCMS auto-generates some, none, or all of the table columns.  Auto-generated columns use the column title from the source file and are sortable.  You can configure individual columns in order to change the column title, turn sorting on/off, etc.

Follow these instructions to create the table:

  1. In Visual Composer, use the “Add Element” option to add a data table.
  2. In the settings pop-up, select the data file in the first field (Data tab).
  3. If you want to ensure that all non-configured columns display, select “On” (the default) for “Show all columns.” (If you select “Off,” you must individually configure the columns you want to display.)
  4. If you would like the WCMS to auto-generate all the table columns, you can skip the “Columns configuration” section. Otherwise, configure for each column as necessary.  For each column, you can change its title and display status, turn sorting on/off, etc.  (Tip:  To see the fields for the first column configuration, you may need to click the expand/collapse arrow in the upper right corner of the configuration panel.)
    Tip:  Configured columns display before non-configured (auto-generated) columns.
  5. Select the Caption Placement:  top, bottom, or hidden.
  6. Enter the caption (required).
  7. Complete the Display tab to set up pagination, alternate row shading, etc.
Screenshot of the settings pop-up (data tab) for a Visual Composer table

The settings pop-up for a Visual Composer table, showing the configuration for one column.

WCMS Quick Facts

Use the “data table” element in Visual Composer if you would like to import table data in CSV or JSON format.  The table structure must be simple (a single row of column headers).

The WCMS strips table inline styles, but in the WYSIWYG table editor you can preserve specific styles. See “Preserving Inline Styles” on this page for more info.

A caption tag is required for every table.

The WYSIWYG table editor supports entry of all attributes needed to associate header cells to data cells, whether you’re using the “scope” attribute or the “headers” and “ID” attributes for complex tables.  See the instructions on this page for more information.

Creating a WYSIWYG Data Table

The Table drop-down menu in the WYSIWYG Editor allows you to insert tables.  Once you insert a table, you can type directly into the table to add headers and data. This document explains how to modify table properties to meet 508 standards and how to style a table using template classes.

Adding a Table Caption

Per Section 508, every table must have a caption tag.

  1. Click inside the table and then select “Table properties” from the Table drop-down menu.
  2. Enter the caption in the Caption field.  (Do not enter any HTML tags for italics, etc.  You can format the text once you return to the WYSIWYG editor.)
  3. While in Table properties, select the position of the caption display (Top, Bottom, or Hidden).  If you hide the caption display, the required caption tag is still created in the HTML (and therefore meets the 508 requirement), but we recommend displaying the caption in most cases.
  4. Click OK to close Table properties. You should now see a row for the table caption has been added to the table.
  5. Use the WYSIWYG editor to italicize scientific terms in the caption and apply any other special formatting required.

Setting Scope Attribute for Headers

To comply with Section 508, all header cells must have the scope attribute (unless you are tagging a complex table with the Headers and ID attributes):

  1. In the WYSIWYG table editor, select the header cells (row or column).
  2. From the Table menu, select “Cell” and then “Table cell properties.”
  3. In Table cell properties, select “Header cell” as the Cell Type and then select the scope type (row, column, etc.).
  4. Repeat if necessary for another set of header cells.

Tagging a Complex Table

If a table has a complex structure such as multiple row and column headers, you may need to use the ID and Headers attributes (instead of the Scope attribute).  You can set both attributes in “Table cell properties” (Table menu, Cell option):

  • Click in each header cell and assign an ID.
  • For each data cell, set the Headers property to indicate which headers apply to the cell (using the header IDs separated by spaces). You can select multiple data cells at a time.

Setting Table Styles

The Table editor allows you to apply template classes to achieve a variety of table styles:

Set the header row type (required for Header Row Color):  Click inside the header row and select “Table row properties” (Table menu, Row option). In Table row properties, set the Row type as “Header.”

Apply table styles:  Click inside the table and select “Table properties” (Table menu). In Table properties there are options for Header Color, Striped Row Color, and Hover Color.

Handling Long Tables

“Enhanced horizontal scrolling” is turned on automatically when you create a table so that wide tables are optimized for mobile viewing.  If your table has a lot of rows but not a lot of columns, consider turning on “enhanced vertical scrolling.” When this option is turned on, the table displays in mobile with only five rows and a “Show More” button that the visitor can click to access the full table.

To access this option, click inside the table and go to Table properties (Table menu). Then set the field “Enhanced Scrolling.”

Preserving Inline Styles

The WCMS automatically strips inline styles from tables, but you can preserve one or more inline styles as follows:

  1. Click inside the table and open Table properties (Table menu).
  2. In Table properties, open the Advanced tab and check “Preserve Inline Styles.”
  3. In the Style field, enter the CSS statement as it would be entered directly into the table tag attributes. Follow the normal rule for CSS (semicolon-separated name/value pairs). for example:

background-color: blue; color: red; height: 20px;

Page last reviewed: August 11, 2020
Content source: WCMS / Template Team