Class: Table

qui.tables.Table(headeropt, headerRowopt, widthsopt, visibilitiesopt, horizontalAlignopt, verticalAlignopt, rowTemplateopt, initialRowsopt, initialValuesopt, …args)

A table view.

Constructor

new Table(headeropt, headerRowopt, widthsopt, visibilitiesopt, horizontalAlignopt, verticalAlignopt, rowTemplateopt, initialRowsopt, initialValuesopt, …args)

Parameters:
Name Type Attributes Description
header Array <optional>

optional table header

headerRow qui.tables.TableRow <optional>

optional table header row (qui.tables.commoncells.SimpleTableCell cells will be used by default)

widths Array.<String> <optional>

table column widths, in percents or absolute values with units

visibilities Array.<Boolean> <optional>

table column visibilities

horizontalAlign Array.<String> <optional>

default horizontal cell alignment for each column; a list containing one of:

verticalAlign Array.<String> <optional>

default vertical cell alignment for each column; a list containing one of:

rowTemplate Array.<qui.tables.TableCell> | Array.<Object> <optional>

an optional row template to use when adding new rows with qui.tables.Table#addRowValues; if a list of objects is supplied, each object must contain a class property indicating the table cell class, while the rest of properties are used as constructor parameters

initialRows Array.<qui.tables.TableRow> <optional>

initial table rows

initialValues Array.<Array> <optional>

initial table values

args * <repeatable>

parent class parameters

Source:

Extends

Methods

addItem(index, item)

Add one item to the list.

Parameters:
Name Type Description
index Number

the index where the item should be added; -1 will add the item at the end

item qui.lists.ListItem

the item

Overrides:
Source:

addRow(index, row)

Add one row to the list.

Parameters:
Name Type Description
index Number

the index where the row should be added; -1 will add the row at the end

row qui.tables.TableRow

the row

Source:

addRowValues(index, values, dataopt) → {qui.tables.TableRow}

Add one row to the list using row template. Table must have a row template.

Parameters:
Name Type Attributes Default Description
index Number

the index where the row should be added; -1 will add the row at the end

values Array

values to set to new row

data * <optional>
null

optional data to pass to row

Source:
Returns:

the added row

Type
qui.tables.TableRow

disableAdd()

Disable the add feature.

Overrides:
Source:

disableSearch()

Disable the search feature.

Overrides:
Source:

enableAdd()

Enable the search feature.

Overrides:
Source:

enableSearch()

Enable the search feature.

Overrides:
Source:

getComputedWidths(rowopt) → {Array.<String>}

Return computed column widths.

Parameters:
Name Type Attributes Default Description
row qui.tables.TableRow <optional>
null

an optional row about to be added

Source:
Returns:
Type
Array.<String>

getHeader() → (nullable) {Array}

Return the table header.

Source:
Returns:
Type
Array

getHeaderRow() → (nullable) {qui.tables.TableRow}

Return the table header row.

Source:
Returns:
Type
qui.tables.TableRow

getHorizontalAlign() → {Array.<String>}

Return the default horizontal alignment for each column.

Source:
Returns:
Type
Array.<String>

getItems() → {Array.<qui.lists.ListItem>}

Return all items.

Overrides:
Source:
Returns:
Type
Array.<qui.lists.ListItem>

getNumColumns(rowopt) → {Number}

Return the number of table columns.

Parameters:
Name Type Attributes Default Description
row qui.tables.TableRow <optional>
null

an optional row about to be added

Source:
Returns:
Type
Number

getRows() → {Array.<qui.tables.TableRow>}

Return all rows.

Source:
Returns:
Type
Array.<qui.tables.TableRow>

getSelectedItems() → {Array.<qui.lists.ListItem>}

Return the currently selected items.

Overrides:
Source:
Returns:
Type
Array.<qui.lists.ListItem>

getSelectedRows() → {Array.<qui.tables.TableRow>}

Return the currently selected rows.

Source:
Returns:
Type
Array.<qui.tables.TableRow>

getValues() → {Array.<Array>}

Return the current values of the table.

Source:
Returns:
Type
Array.<Array>

getVerticalAlign() → {Array.<String>}

Return the default vertical alignment for each column.

Source:
Returns:
Type
Array.<String>

getVisibilities() → {Array.<Boolean>}

Return column visibilities.

Source:
Returns:
Type
Array.<Boolean>

getWidths() → {Array.<String>}

Return column widths.

Source:
Returns:
Type
Array.<String>

isAddEnabled() → {Boolean}

Tell if the add feature is enabled

Overrides:
Source:
Returns:
Type
Boolean

isSearchEnabled() → {Boolean}

Tell if the search feature is enabled

Overrides:
Source:
Returns:
Type
Boolean

onAdd() → (nullable) {Promise}

Override this to define the behavior of the list when the add button is pressed.

Overrides:
Source:
Returns:

an optional promise which, if rejected with no argument, will cancel adding

Type
Promise

onSelectionChange(oldItems, newItems) → (nullable) {Promise}

Called when the current selection is changed by user.

Parameters:
Name Type Description
oldItems Array.<qui.lists.ListItem>

the previously selected items (can be empty)

newItems Array.<qui.lists.ListItem>

the new selected items (can be empty)

Overrides:
Source:
Returns:

an optional promise which, if rejected with no argument, will cancel the selection change

Type
Promise

prepareItem(item)

Prepare item to be part of this list.

Parameters:
Name Type Description
item qui.lists.ListItem
Overrides:
Source:

removeItem(item) → {Boolean}

Remove a specific item.

Parameters:
Name Type Description
item qui.lists.ListItem

the item to remove

Overrides:
Source:
Returns:

true if item found and removed, false otherwise

Type
Boolean

removeItemAt(index) → (nullable) {qui.lists.ListItem}

Remove the item at a given index.

Parameters:
Name Type Description
index Number

the index of the item to remove

Overrides:
Source:
Returns:

the removed item

Type
qui.lists.ListItem

removeItems(matchFunc) → {Array.<qui.lists.ListItem>}

Remove all items that match a condition.

Parameters:
Name Type Description
matchFunc qui.lists.ListItemMatchFunc
Overrides:
Source:
Returns:

the removed items

Type
Array.<qui.lists.ListItem>

removeRow(row) → {Boolean}

Remove a specific row.

Parameters:
Name Type Description
row qui.tables.TableRow

the row to remove

Source:
Returns:

true if row found and removed, false otherwise

Type
Boolean

removeRowAt(index) → (nullable) {qui.tables.TableRow}

Remove the row at a given index.

Parameters:
Name Type Description
index Number

the index of the row to remove

Source:
Returns:

the removed row

Type
qui.tables.TableRow

removeRows(matchFunc) → {Array.<qui.tables.TableRow>}

Remove all rows that match a condition.

Parameters:
Name Type Description
matchFunc qui.tables.TableRowMatchFunc
Source:
Returns:

the removed rows

Type
Array.<qui.tables.TableRow>

setHeader(headernullable)

Set or clear the table header.

Parameters:
Name Type Attributes Description
header Array <nullable>
Source:

setHeaderRow(headerRownullable)

Set table header row. If null is passed, qui.tables.commoncells.SimpleTableCell are used to build a table row.

Parameters:
Name Type Attributes Description
headerRow qui.tables.TableRow <nullable>

table header row

Source:

setItem(index, item)

Update one item.

Parameters:
Name Type Description
index Number

the index where to perform the update

item qui.lists.ListItem

the item to update

Overrides:
Source:

setItems(items)

Set the items of the list.

Parameters:
Name Type Description
items Array.<qui.lists.ListItem>

list items

Overrides:
Source:

setRow(index, row)

Update one row.

Parameters:
Name Type Description
index Number

the index where to perform the update

row qui.tables.TableRow

the row to update

Source:

setRows(rows)

Set the rows of the list.

Parameters:
Name Type Description
rows Array.<qui.tables.TableRow>

table rows

Source:

setRowTemplate(rowTemplate)

Update the row template to use when adding new rows with qui.tables.Table#addRowValues; if a list of objects is supplied, each object must contain a class.

A call to this method won't affect the currently added rows.

Parameters:
Name Type Description
rowTemplate Array.<qui.tables.TableCell> | Array.<Object>
Source:

setSelectedItems(items)

Update current selection.

Parameters:
Name Type Description
items Array.<qui.lists.ListItem>

the list of new items to select; empty list clears selection

Overrides:
Source:

setSelectedRows(rows)

Update current selection.

Parameters:
Name Type Description
rows Array.<qui.tables.TableRow>

the list of new rows to select; empty list clears selection

Source:

setSelectMode(selectMode)

Set selection mode.

Parameters:
Name Type Description
selectMode String

one of:

Overrides:
Source:

setValues(values, indexopt)

Set table values. If more values than needed are supplied, extra values are ignored. If less values are supplied, extra rows are left unchanged.

Parameters:
Name Type Attributes Default Description
values Array.<Array>
index Number <optional>
0

optional start index (defaults to 0)

Source:

setVisibilities(visibilitiesnullable)

Set column visibilities.

Parameters:
Name Type Attributes Description
visibilities Array.<Boolean> <nullable>

table column visibilities

Source:

setWidths(widths)

Set column widths.

Parameters:
Name Type Description
widths Array.<String>

table column widths, in percents or absolute values with units

Source: