This table contains logic to show a table as a panel in an app. This table features sorting rows can be expanded to show hidden data

<FwTableSortable @data= @columns= @title='Table' />

If used in a block format instead, it is possible to fully define the title area, replacing the title parameter. The export action is passed as a yield parameter to redefine the export button

<FwTableSortable @data= @columns= as |export|>
    <strong class='panel-title'>Table</strong>
</FwTableSortable>

In addition to the usual properties in columns, fw-table-sortable supports adding an additional sortKey property If defined, clicking that column will sort by that property instead of valuePath

It also supports a showExpanded property, which is set to a value which will cause this row to show in the expanded view if hidden. Alternatively, setting this to true or false will force the state regardless of a property. By default will show if the property from valuePath is not null

Show:
didReceiveAttrs () private

Initializes the component and loads the modal path.

updateTableColumns () private

Callback to update the table columns whenever they change. Unlikely, but still a case worth covering

updateTableRows () private

Callback to update the table rows whenever the data is changed, generally from sorting

_defaultSort

Array private

Private copy of defaultSort, made an array if its not

breakpoints

Hash public

Hash of maximum columns based on responsive size

canExport

Boolean | String public

Allows exporting the current contents of the table using an export button. Note that this sets a default title of "Table", so setting a separate one is recommended

When enabled, columns have some additional values defined:

  • canExport: if true (default), the column will be included in the export. Set to false to skip exporting the column.
  • exportOnly: if true, the column will not show in the table, but will still be exported.

Additionally, the value export is set to true in format's context.

If this is set to a string, the string is used as the name of the export button.


Default: false

columns

Array public

Table columns. See ember-light-table docs for more information

data

Array public

Table rows

defaultSort

String | Array public

Default sort order for the table. Can be a string for a single property, or an array to fallback

deleteOverrideTitle

String

Determines title for delete function. This will only be used if deleteTable action is passed in.

deleteTable

Action

Called to delete the full page of entries. Pass in the action to be called by the button.


Default: undefined

deleteTablePermissions

Boolean

Determines if the current user has permission to delete the table (usually has-role helper will be used to determine this) example: @deleteTablePermission={{has-role 'admin'}}. This will only be used if deleteTable action is passed in.


Default: true

empty

String public

Text to display when the table is empty

exportTitle

String private

Computed table title based on whether a boolean true is passed or a title

fixedHeight

String public

Sets the table to a fixed height, and adds a scroll bar to see the hidden rows

headerEmpty

Boolean public

Set to false to make the table not show the header if empty


Default: true

onSort

Action public

Action called when sorting the table

resizeOnDrag

Boolean public

Makes the headers able to be dragged to resize. You will still need to put resizable: true in each column you want to be able to resize.


Default: false

responsive

Boolean public

Makes the table responsive to the screen width. The table is slightly more efficient if false when responsive is not used


Default: false

showFooter

Boolean public

If true, uses the table block data for the footer


Default: true

showHeader

Boolean public

If true, uses the table block data for the header


Default: true

sortColumn

String private

Sort column set by clicking a column to sort

sortedData

Array private

Passed in table data after sorting.

sortOrder

Array private

Internal sort order. Calculated from sortColumn and _defaultSort

table

Table protected

Internal table instance, in general changes to the table should be done to columns or data so they update propery

tableActions

Hash public

Hash of actions to pass into the table for use in components

tableClassNames

Hash public

Additional class names for the table

title

String public

Title to display in the panel above the table