All Implemented Interfaces:
Serializable, DynamicAttributes, IterationTag, JspTag, Tag, DynamicActionAttributes

public class Table extends StylableTag
This is the main tag for the table. It must be located inside a <base:page> tag.

Syntax:

   <tbl:table
      id=...
      clazz=....
      style=...
      title=...
      sortby=...
      direction=ASC|DESC
      columns=...
      filterrows=...
      sc=...
      item=...
      subcontext=...
      action=...
      stickyheaders=...
      dragcolumns=true|false|null
   >
Tag attributes
Attribute Default value Required Description
id - yes The ID of the table. The value of this attribute goes directly into the standard HTML id attribute. This means that if you need a reference to the table object in your own JavaScript code, you may for example use the following code:
table = document.getElementById('<id>');
clazz - no The value if this attribute goes directly into the standard HTML class attribute. This allows you to apply different styles to different tables.
style - no The value if this attribute goes directly into the standard HTML style attribute. This allows you to apply different styles to different tables.
title - no An optional title that will be displayed in <h3> format directly above the table.
sortby - no Matches the property attribute on a <tbl:columdef> tag. This column will then be marked with an upwards or downward pointer according to the direction attribute.
direction asc no The value should be either asc or desc to indicate if the rows are sorted in ascending or descending order. Other values are interpreted as asc.
columns - no A comma-separatd list of column ID:s. Only columns with an ID in the list will be shown in the table. The special value all shows all columns. Individual columns may override this setting by specifying always or never instead of the default auto value in their show attribute.
filterrows 1 no Number of filter rows that should be displayed in the table.
action name of current page no The action property of the <form> tag.
sc - no The current SessionControl object. Used by some child taglibs for generating context sensitive information.
item - no The current Item object. Used by some child taglibs for generating context sensitive information (ie. PresetSelector).
subcontext "" (empty string) no The name of the current subcontext. Used by some child taglibs for generating context sensitive information (ie. PresetSelector).
stickyheaders - no Enable sticky headers and optionally set the name of a sticky column. Do not set this attribute if the table should not have sticky headers.
dragcolumns null no If set, controls if columns can be re-ordered by dragging them in the GUI. If null, the feature is enabled only if the "action" and "item" attributes are not null.

The <tbl:table> may contain the following subtags:

Version:
2.0
Author:
Nicklas
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • page

      private Page page
      The parent <base:page> tag.
    • title

      private String title
      An optional title of the table.
    • sortby

      private String sortby
      The column to sort by. Should match the sort attribute on the column tag.
    • sortColumns

      private Map<String,ItemContext.SortDirection> sortColumns
    • action

      private String action
    • sc

      private transient SessionControl sc
    • itemType

      private Item itemType
    • subcontext

      private String subcontext
    • sortDirection

      private ItemContext.SortDirection sortDirection
      ASC or DESC
    • columns

      private String columns
      Which columns that should be visible and their order
    • stickyHeaders

      private boolean stickyHeaders
      If sticky headers is enabled or not.
    • stickyCol

      private String stickyCol
      The id of a column that is "sticky".
    • numFilterRows

      private int numFilterRows
      Number of filter rows in the table.
    • hiddenForm

      private StringBuilder hiddenForm
    • evenodd

      private int evenodd
      Keep track of which class to use for the next row.
    • rowclass

      private static final String[] rowclass
      The class names for even and odd row respectively.
    • allVisible

      private boolean allVisible
      "all" was specified for the columns attribute.
    • visibleColumns

      private Set<String> visibleColumns
      The ID of all visible columns, sorted by the order they should appear.
    • definedColumns

      private Set<String> definedColumns
      The ID of all defined columns
    • columnContent

      private Map<String,String> columnContent
    • columnFilter

      private Map<String,String> columnFilter
    • columnSubtitle

      private Map<String,String> columnSubtitle
    • columnFormatter

      private transient Map<String,Formatter<?>> columnFormatter
    • hiddenFilteredColumns

      private Set<String> hiddenFilteredColumns
    • extensionColumns

      private List<ListColumnAction> extensionColumns
    • jsonColumnDefs

      private org.json.simple.JSONArray jsonColumnDefs
    • numHeaderColumns

      private int numHeaderColumns
    • numFilteredColumns

      private int numFilteredColumns
    • dragColumns

      private Boolean dragColumns
  • Constructor Details

    • Table

      public Table()
  • Method Details

    • setTitle

      public void setTitle(String title)
    • getTitle

      public String getTitle()
    • setColumns

      public void setColumns(String columns)
    • getColumns

      public String getColumns()
    • setStickyheaders

      public void setStickyheaders(String stickyCol)
      Since:
      3.18.1
    • hasStickyHeaders

      public boolean hasStickyHeaders()
      Since:
      3.18.1
    • getStickyCol

      public String getStickyCol()
      Since:
      3.18.1
    • setDragcolumns

      public void setDragcolumns(Boolean dragColumns)
      Since:
      3.8
    • getDragcolumns

      public Boolean getDragcolumns()
    • setFilterrows

      public void setFilterrows(int filterRows)
      Since:
      3.5
    • getFilterrows

      public int getFilterrows()
    • setSortby

      public void setSortby(String sortby)
    • getSortby

      public String getSortby()
    • setAction

      public void setAction(String action)
    • getAction

      public String getAction()
    • setSc

      public void setSc(SessionControl sc)
    • getSc

      public SessionControl getSc()
    • setItem

      public void setItem(Item itemType)
    • getItem

      public Item getItem()
    • setSubcontext

      public void setSubcontext(String subcontext)
    • getSubcontext

      public String getSubcontext()
    • setDirection

      public void setDirection(String direction)
    • setDirection

      public void setDirection(ItemContext.SortDirection direction)
    • getDirection

      public ItemContext.SortDirection getDirection()
    • getPage

      Page getPage()
    • addColumnDef

      void addColumnDef(ColumnDef cd, ListColumnAction extensionColumn)
    • endColumnDefinitions

      void endColumnDefinitions()
    • isColumnVisible

      boolean isColumnVisible(String columnId)
    • getVisibleColumns

      Set<String> getVisibleColumns()
    • isColumnSticky

      boolean isColumnSticky(String columnId)
    • getFormatter

      Formatter<?> getFormatter(String columnId)
    • setColumnContent

      void setColumnContent(String columnId, String content)
    • getColumnContent

      Map<String,String> getColumnContent()
    • getColumnSubtitles

      Map<String,String> getColumnSubtitles()
    • setColumnFilter

      void setColumnFilter(String columnId, int row, String filterHtml)
    • addFilteredColumn

      void addFilteredColumn(String columnId, String filterProperty, boolean visible)
    • getHiddenFilteredColumns

      Set<String> getHiddenFilteredColumns()
    • writeColumns

      int writeColumns() throws Exception
      Throws:
      Exception
    • writeColumnFilters

      int writeColumnFilters(int row) throws Exception
      Throws:
      Exception
    • writeColumnSubtitles

      int writeColumnSubtitles(StringBuilder sb)
    • endColumnFilters

      void endColumnFilters()
    • getSortDirection

      ItemContext.SortDirection getSortDirection(String colum)
      Get the sort direction on the given column. If it is not used for sorting, null is returned.
      Since:
      3.3
    • getDirectionImage

      String getDirectionImage(ItemContext.SortDirection direction)
      Get sort direction <img> element for the given direction. Return an empty string if direction = null.
      Since:
      3.3
    • getNextRowClass

      String getNextRowClass()
    • addHidden

      void addHidden(String name, String value)
    • numVisibleColumns

      int numVisibleColumns()
    • getNumFilteredColumns

      int getNumFilteredColumns()
    • setNumColumns

      void setNumColumns(int numColumns)
    • numHeaderColumns

      int numHeaderColumns()
    • getExtensionColumns

      List<ListColumnAction> getExtensionColumns()
    • allowColumnDrag

      boolean allowColumnDrag()
      Can header columns be dragged for re-ordering? If setDragcolumns(Boolean) has been set we use that value, otherwise we only allow it if the "action" attribute has been set.
      Since:
      3.8
    • doStartTag

      public int doStartTag() throws JspException
      Specified by:
      doStartTag in interface Tag
      Overrides:
      doStartTag in class TagSupport
      Throws:
      JspException
    • doEndTag

      public int doEndTag() throws JspException
      Specified by:
      doEndTag in interface Tag
      Overrides:
      doEndTag in class TagSupport
      Throws:
      JspException