This table contains client-side logic to resort a "table" of models. This resort table will not call the actual serverside "save" function, so you will need to persist the changes to the database yourself, but it will do everything else for you (ie all you should have to do is call save, and the reorder will work). A basic usage example is the following:
<FwTableResort @items={{items}} @titleKey='name' @sortKey='sorted' />
If used in a block format instead, it is possible to fully define the title area, such as to replace it with input fields, which also adds a cheveron to expand if desired
<FwTableResort @items={{items}} @sortKey='sorted' as |item expanded|>
{{input item.name}}
</FwTableResort>
Currently the only way to have a display title different from the default sort is to use the block format manually (set the titleKey
to the desired default sort, and then manually display
the other desired property).
Methods
deleteIcon
String publicThe icon that will be used for the delete button. Useful if you want the button to do something other than delete.
Default: fa-regular fa-trash-can
items
Boolean publicRequired property. This is what you pass the array of items you wish to sort with the table.
sortKey
String publicString pointer to the model's sort key, will be used to sort the items and modify the key later
title
String publicDefault sort for if the sort key is undefined and title to display if no block is used
viewableItems
Array privateAn internal list of all items which will be shown in the table (takes into account activeKey and activeFilter)