Common table capabilities

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.
  • autoNumberSort - If autoNumberSort=true, the auto number column will be sortable and will retain the original data row count even after row sorting.
  • 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:

Name Phone TCP
John 555-1234 192.168.1.10
Mary 555-2134 192.168.1.12
Bob 555-4527 192.168.1.9
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Aug 09, 2007

    rakesh kumar says:

    I would like to display a table with alternating background colors for rows.&nbs...

    I would like to display a table with alternating background colors for rows.  I am unable to find a macro or a property which can do that.  Is there a converter which can convert the html code of a table to the equivalent confluence wiki's format.

    Is it possible to just build the page using the html itself?

     thanks in advance

    --rk

    1. Aug 09, 2007

      Fennie Ng says:

      Hi Rakesh, Perhaps, you want to give a try to the Content Formatting Macros Plu...

      Hi Rakesh,

      Perhaps, you want to give a try to the Content Formatting Macros Plugin to see if it helps.

      Regards,
      Fennie.

  2. Jul 23

    Jean-Pierre Picchiottino says:

    I used the above examples to create a table that would list some of our customer...

    I used the above examples to create a table that would list some of our customers and the products that they use.  They work well with one exception:

     If some of the names are acronyms, then the table will first sort all names in capital letters, then the others.  For example:

     AXXX, Aaaa, Azzz will be sorted as AXXX, Aaaa, Azzz rather than Aaaa, AXXX, Azzz.  The only way I found is obviously to replace "AXXX" by Axxx but of course, it doesn't look very good, especially for our customers.

    Is there any way around this?

    Thanks in advance,

    JP

  3. Aug 11

    Crystal Johnson says:

    Is there a way for the user to select a button to insert a row in the table plus...

    Is there a way for the user to select a button to insert a row in the table plus macro? My code is below, I thought toggle clock may work but I can't seem to get it to work the way I need it too.

    Thanks,
    Crystal

     {table-plus:autoTotal=true|columnTypes=S,S,I,I|autoNumber=true|
    columnAttributes=,,style="background:yellow; font-size:12pt;"}
    
       {sub-section:edit_budget}
    
    ||Capital Budget|| Detail || Capital|| Expense||
      | hardware| @hw_detail|textarea(2x20)@| {metadata:Hardware}@hw_cap|textarea(2x20)@{metadata}| @hw_exp|textarea(2x20)@ |
      | Software| @sw_detail|textarea(2x20)@|{metadata:Software}@sw_cap|textarea(2x20)@{metadata}| @sw_exp|textarea(2x20)@ |
      | Internal Labor| @labor_detail|textarea(2x20)@|{metadata:Labor}@labor_cap|textarea(2x20)@{metadata}| @labor_exp|textarea(2x20)@ |
      | Outside Services| @services_detail|textarea(2x20)@|@services_cap|textarea(2x20)@| @services_exp|textarea(2x20)@ |
      | User Acceptance| @user_detail|textarea(2x20)@|@user_cap|textarea(2x20)@| @user_exp|textarea(2x20)@ |
      | Writeoff| @write_detail|textarea(2x20)@|@write_cap|textarea(2x20)@| @write_exp|textarea(2x20)@ |
    
    
    {sub-section}
    {table-plus}