Skip to end of metadata
Go to start of metadata

On this page

Overview

A number of macros that produce or modify tables share common capabilities as described below. A JavaScript enabled browser is required to enable most of these capabilities.

Capabilities

  • Column sorting - sort a column by clicking on column heading. Clicking again will reverse the order. 
  • Data specific sorting - see the columnTypes parameter
  • Column selection - hide columns
  • Auto sort of selected column
  • Auto numbering of rows - ability to automatically add a leading column with the data row count.
  • Auto totaling of numeric columns
  • Row highlighting on mouseover - the row is highlighted when mouse goes over any row element for non-heading rows
  • Row styles - ability to set CSS at the row level
  • Column styles - ability to set CSS at the column level
  • Column attributes - ability to set the display attributes (color, font) on a column basis
  • Table attributes - set table class, table style, and row styles - See Styling Table Columns

Macros that include this support

Common parameters

The following parameters are part of our common table capabilities that are available to many macros that produce or modify tables.

(info) Click a column heading to toggle the sorting of that column.

ParameterDefaultMacro Browser LabelDescription

heading

1Heading rows

Number of rows to be considered as heading rows. Heading rows do not participate in column sorting.

footing

0Footing rows

Number of rows to be considered as footing rows. Footing rows do not participate in column sorting.

enableSorting

trueEnable column sortingSet to false to disable sorting.

enableHighlighting

trueEnable row highlighting on mouse overAs the mouse moves over a table row, the row will be highlighted by default. Set to false to stop this behavior.

sortColumn

 Auto sort columnThe 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

falseSort descendingIf sortColumn is used, this determines the order of the sort that is automatically done before display.

sortTip

 Sort tip on mouse overText displayed when mouse is over a sortable column. Normally, this value is Click to sort or equivalent translation.

sortIcon

falseShow sort iconUse 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

lightgoldenrodyellowHighlight colorColor of row when mouse is over a row element. See Web colors for how to specify.

autoNumber

falseAuto number on each rowUse true to show an additional column that show row number for each data row.

autoNumberSort

falseAuto number sortUse true to enable the auto number column to be sortable. This will retain the original data row count even after row sorting.

autoTotal

falseAuto total rowUse true to append a row to the end of the table that will contain totals of all numeric columns.

columnTypes

 Column typesColumn types determine how column data is sorted and displayed. By default, column data is treated as a text string sorted alphabetically. Some macros, like the SQL and CSV macros, may automatically generate more precise types. When the default behavior is less than optimal for your situation, the columnTypes parameter can be set specifically. This describes the behavior of the various types. In addition, numeric types are right aligned and can result in a total row entry.
TypeDescriptionSorting

Total Formatting

Data Formatting
SText string. This is a series of one or more alphanumeric characters, possibly including a letter, number, space, punctuation mark or other special characters.Alphabetic  
IInteger. This is a numeric field without a fractional component.Numeric(tick) 
FNumeric or float value and may contain numeric separators including a decimal point and a comma for thousands separator.Numeric(tick) 
FFNumeric or float value and may contain numeric separators including a decimal point and a comma for thousands separator. Forced formatting of data columns.Numeric(tick)
FCNumeric or float value and may contain numeric separators including a comma for decimal separator and a period for thousands separator.Numeric(tick) 
CSimilar to F with more leniency on leading and trailing characters to allow currency and similar symbols to be present and ignored.Numeric(tick) 
CCSimilar to FC with more leniency on leading and trailing characters to allow currency and similar symbols to be present and ignored.Numeric(tick) 
M

Date format in many popular formats. See Advanced Date Sorting for more information. This is the preferred date sorting type.

Date (tick)
DDate in the browser date format. See Advanced Date Sorting for more information. The D type is available for compatibility with older releases - the M type is recommended.Date  
EEmotions or other HTML elements.Alphabetic on the inner HTML value  
XIndicates to exclude this column from user selectable sorting.Disabled  
.Separated numbers, like phone numbers or TCP addresses. Valid values are multiple integer numbers separated by '.'.Numeric on each separated value  
:Separated numbers, like phone numbers or TCP addresses. Valid values are multiple integer numbers separated by ':'.Numeric on each separated value  
- Separated numbers, like phone numbers or TCP addresses. Valid values are multiple integer numbers separated by '-'.Numeric on each separated value  
/Separated numbers, like phone numbers or TCP addresses. Valid values are multiple integer numbers separated by '/'.Numeric on each separated value  
HIndicates to hide the column.   
columnCalculations Column calculationsWhen an auto total row is selected, this parameter can be used to customize the calculation or text that is shown on the total row. By default, all numeric fields, as specified by column types, are totaled. By specifying a comma separated list of calculation requests, the behavior can be modified using special values for the corresponding column.
TypeResult
sumColumn entries are totaled. The column type must be numeric.
avgColumn entries are totaled and then divided by the number of data rows. The column type must be numeric.
<other text>Any other text including a blank field will be copied to the corresponding total row field. No calculations will be done.

rowStyles

 Table row styles

A comma separated list of styles. Each style is made up of one or more properties. The first is applied to all heading rows determined by the heading parameter. The remaining styles are applied to the remaining rows in order with repetition as necessary. Row styles are applied to the table row and participate with other CSS properties to determine the look of an element. In particular, some properties may be overridden by table or element styles or classes.

Example: , background:lightyellow, background:lightblue

retainRowStyleOrder

trueRetain row style order after sorting

When selected, the row styles correspond to the order the rows are displayed on the screen. When not selected, the original style given to a row is retained not matter where the row lands after sorting.

columnStyles Column styles

Comma separated list of styles. Each style is made up of one or more CSS properties (semi-colon separated). The styles are applied to columns in sequence. If a column is skipped, supply a comma before adding the next columns style. A style can be reused for subsequent column(s) by referring to it using a 1-based numeric reference. Column styles are applied to the table column and participate with other CSS properties to determine the look of an element. In particular, some properties may be overridden by table, row, or element styles or classes.

Example: background:lightyellow, background:lightblue,1,2,1,2

columnAttributes

 Column attributesA 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

trueEnable heading attributesAny column attributes provided will be applied to the all column rows including heading rows. Use false to have the column attributes apply only to data rows.

id

auto generatedTable idTable id can be referenced for use in macros (like the chart macro) or javascript.

class

@defaultTable classSets the class of the table. Normally, it will be confluenceTable. Use a blank (one or more spaces) value to not have any table class.

style

 Table styleStyle attributes can be set. For example: font-style:italic; background:lightblue;.

width

 Table widthIn pixels or %. Recommend using style settings instead.

border

 Table border widthIn pixels. Set class to blank also. Recommend using style settings instead.

Date sorting

Examples

{table-plus:columnTypes=S,-,.|autoNumber=true|sortColumn=3
|columnAttributes=style="text-align:center;", ,style="background:yellow; font-size:14pt;"}
|| Name || Phone || TCP ||
| John | 555-1234 | 192.168.1.10 |
| Mary Lou | 555-2134 | 192.168.1.12 |
| Bob | 555-4527 | 192.168.1.9 |
{table-plus}

which renders as:

Name

Phone

TCP

John

555-1234

192.168.1.10

Mary Lou

555-2134

192.168.1.12

Bob

555-4527

192.168.1.9

Find answers from the community.

Ask a question to the community.

Log a request with our support team.

 

Availability

 

 

 


Examples for this Add-on

10 Comments

  1. Hi,

    Highlighting of table rows (on mouse-over) does not work when the Documentation Theme is in use. Seems to be a CSS conflict or similiar. In all other themes it does work fine, just it doesn't in the Documentation Theme which is by incident my favorite theme..... Hi Mr Murphy....

    Issue found using Firefox and MS-IE. Our Confluence version is 3.5.9

    Any way to fix this issue?

    1. I don't see a problem on this page which uses the documentation theme: Groovy Tasks for Bamboo. Please narrow down the problem and create an issue if necessary.

      1. Hi Bob, I copied your small {csv} piece from your page and tried it on my server. Same behavior. Can turn issue on and off by changing the Theme.

        What do you suggest to try to narrow down the problem?

        I checked our stylesheet. The only customization on its CSS are #header and #breadcrump. Can't imagine that this influences the rendering of tables.

      2. I hacked a bit and found that the mouseover and mouseout event-handlers are working fine. Problem seems to be with <TR bgcolor>.

        I narrowed the problem down to com.atlassian.confluence.plugins.doctheme:documentation/splitter.css.

        As soon as this css is imported, the problem appears.

        splitter.css sets

        body, p, td, table, tr, .bodytext, .stepfield, .wiki-content p, .panelContent, .wiki-content a{
                color: #000;
                background: #fff;
            }
        

        I'm not an css expert. Is this related to the observed behavior? I think at some point the color specified by splitter.css overrides the colors set by your javascript.

        1. I think I found the offending line in splitter.css:

          body, p, td, table, tr, .bodytext, .stepfield, .wiki-content p, .panelContent{
              color: #333;
              background:none;
          }
          

          If I remove the line "background:none;", the row highlighting works.

          I'm trying to find a quick solution without waiting for you to fix the plugin.

          Since the splitter.css is in a jar file which I don't want to modify and rebuild, is there a way to overwrite this in the space's style sheet? (Space admin menu?)

          What would the the correct syntax to make this happen?  Any side effects to expect by doing so?

  2. it would be great if you could add 2 more features:

    • allow to specify the background color for individual cells, not just the whole column
    • merged cells (col span)

    These are the most requested features to be added to Confluence tables.

    (I guess it would be hard to implement while staying backwards compatible with the existing Confluence 3.x table format)

    1. Please create separate issues for new request you have. Improvements get looked at each time a new release is being worked on.

  3. Is their a way to apply a style to an individual cell?

    1. No, not really. It is by column and row. However, for individual entries, you can probably use some other macros like from Content Formatting Macros.