Ask the assistant
0/400
Your question is processed by an AI service and kept to improve answers. Do not enter personal data.

    DataTable

    A Material table: a heading row and data rows. Headings are children with id:column , rows are children with id:row (usually Row id:row ); each child of a row becomes a cell.

    Type: multi-child

    DataTable
      Text id:column "Name"
      Text id:column "City"
      Row id:row
        Text "Anna"
        Text "Leeds"
      Row id:row
        Text "Boris"
        Text "York"

    Parameters

    Parameter Type Default Description
    headingRowColor color — Background of the heading row
    dataRowColor color — Background of the data rows
    sortColumnIndex int — Number of the column (from zero) that shows the sort arrow
    sortAscending bool true Direction of the sort arrow
    dataRowMinHeight double from the theme Minimum row height
    dataRowMaxHeight double from the theme Maximum row height
    headingRowHeight double from the theme Height of the heading row
    horizontalMargin double from the theme Margin to the left and right of the outer columns
    columnSpacing double from the theme Distance between columns
    showCheckboxColumn bool true Column of row selection checkboxes
    dividerThickness double from the theme Thickness of the lines between rows

    Children

    • id:column — a column heading; the child itself is drawn in the heading cell. Parameters on it: numeric:true — a numeric column (aligned right), tooltip:"…" — a hint for the heading.
    • id:row — a data row; its children become cells in order. Extra ones (more than there are columns) are dropped, missing ones are filled with empty cells.
    • A table without a single id:column is not drawn.

    sortColumnIndex only draws the arrow at the heading: the rows are not reordered, sorting is done by the markup (for example, by the order of the data).

    Examples

    A price list with a numeric column

    DataTable headingRowColor:#f1f5f9 sortColumnIndex:1 sortAscending:false
      Text id:column "Item"
      Text id:column numeric:true tooltip:"Price in dollars" "Price"
      Row id:row
        Text "Coffee"
        Text "3.20"
      Row id:row
        Text "Tea"
        Text "2.50"
      Row id:row
        Text "Cocoa"
        Text "2.80"

    A compact table without checkboxes

    DataTable showCheckboxColumn:false dataRowMinHeight:32 dataRowMaxHeight:40 headingRowHeight:40 columnSpacing:24 horizontalMargin:12 dividerThickness:1
      Text id:column "Day"
      Text id:column numeric:true "Steps"
      Row id:row
        Text "Mon"
        Text "8,400"
      Row id:row
        Text "Tue"
        Text "10,120"

    Differences between the app and the site

    On the site DataTable is an ordinary full-width HTML table ( <table> ): headings in grey semibold, rows separated by lines. headingRowColor and dataRowColor are read. The sort arrow ( sortColumnIndex , sortAscending ), numeric alignment, tooltip , row heights, margins, columnSpacing , dividerThickness and the checkbox column are not drawn on the site.

    See also

    • Row — an id:row data row
    • Text — cell content
    • ListView — long lists where a table is not needed