Common table based capabilities and parameters
A number of macros that produce or modify tables share common capabilities. This page documents the behavior and parameters for these capabilities. A JavaScript enabled browser is required to enable these capabilities.
Macros that include this support
Capabilities
- Column sorting - sort a column by clicking on column heading. Clicking again will reverse the order. Auto sorting before display
- Row highlighting on mouse over - row is highlighted when mouse goes over any row element for non-heading rows
- Column attributes - ability to set the display attributes (color, font) on a column basis
- Auto numbering - ability to automatically add a leading column with the data row count.
Parameters
- heading - Number of rows to be considered heading rows (default is 1 row). Specify heading=false or heading=0 to not show any heading lines. Heading rows do not participate in sorting.
- footing - Number of rows to be considered footing rows (default is 0). Footing rows do not participate in sorting. An auto total row is automatically treated as a footing row.
- enableSorting - Set enableSorting=false to prevent sorting
- enableHighlighting - As the mouse moves over a table row, the row will be highlighted by default. Set enableHighlighting=false to stop this behavior. This parameter was formerly known as highlightRow which still works.
- sortColumn - The table can be auto sorted before it is displayed by any valid column name or number provided by this parameter. No auto sorting will be done if this value is not provided or is invalid. A column number is a 1-based count of columns (excluding auto number column).
- sortDescending - If sortDescending=true, the sort indicated by the sortColumn will be done in reverse order.
- sortTip - Text that is used to provide user feedback with mouse is over a column heading that is sortable. Default text is: "Click to sort" followed by the column name if available.
- sortIcon - Default is false to not show sort indicator icon. Set sortIcon=true to include a sort icon in the first heading row for sortable columns. An icon will show for the last column sorted indicating the direction the column was sorted.
- highlightColor - Color of row when mouse is over a row element. See the notation guide or Web colors for how to specify.
- autoNumber - If autoNumber=true, an additional column will be added that will count each data row.
- autoNumberSort - If autoNumberSort=true, the auto number column will be sortable and will retain the original data row count even after row sorting.
- autoTotal - If autoTotal=true, an additional row will be appended to the end of the table that will contain totals of all numeric columns.
- columnTypes - By default, all columns are treated as strings for sorting purposes unless a more specific sort type is provided either by the macro logic or by this parameter. The parameter is a comma separated list of column type indicators to identify column types.
- S - string
- I - integer
- F - float
- C - currency or similar where it is a float value with pre or post characters
- D - date in the browser date format. See #advancedDate for more information.
- X - exclude this column from user selectable sorting
- H - hide the column
- . or - or : or / - separated numbers, like phone numbers or TCP addresses. Valid values are multiple integer numbers separated by one of the separators indicated by the type.
- columnAttributes - A comma separated list of values used to modify cell attributes for all cells in a column. The position in the comma separated list corresponds to the column that the values apply to. Each value is a double semi-colon list of attributeName=value pairs that will be applied to the column cells.
- enableHeadingAttributes - By default, any column attributes provided will be applied to the all column rows including heading rows. Set enableHeadingAttributes=false to have the column attributes apply only to data rows.
- id - Sets the table id for the table for use in macros (like the chart macro) to identify a specific table.
Advanced date sorting
The default date handling (using the D column type) provides support for the browser default date format. This may not
work properly for tables that have date format that are different than the default format set for individual browsers. More advanced and automatic capabilities are possible by installing a specific date handling library. Documentation and source for the library can be found at JavaScript Toolbox. Install the date.js file on your Confluence server in .../includes/js directory.
Once the date library is installed, the D column type will now match successfully on many different date formats. Alternatively, setting a column type of D followed by a valid date format. Note that date formats that contain a comma (,), must be enclosed in a double quote.
Date examples:
Column type |
Example date |
---|---|
DMM/dd/yyyy |
01/08/2007 |
D"MMM d, yyyy" |
Jan 8, 2008 |
D |
Many popular date formats |
Note that the date library is in English for date formats that include characters. It is possible to easily modify the date library for other languages before installing it on your server.
Examples
{table-plus:columnTypes=S,-,.|autoNumber=true|sortColumn=3 |columnAttributes=,,style="background:yellow; font-size:14pt;"} || Name || Phone || TCP || | John | 555-1234 | 192.168.1.10 | | Mary | 555-2134 | 192.168.1.12 | | Bob | 555-4527 | 192.168.1.9 | {table-plus}
which renders as: