For an in depth guide on how to implement pagination, including on the server, see our Paginated Table Concept.
All of the possible parameters are documented below. At its most basic, however, there are two ways to use FwPaginationWrapper
in parameter form or in block form. Here is a brief example of each:
Parameter form:
<FwPaginationWrapper @modelName="myModel" @defaultSortKey="sortKey" @makeQuery={{action "makeQuery"}} @getTitle={{action "getTitle"}} @getTableColumns={{action "getTableColumns"}} @tableActions={{hash ...}} as |actions|>
{{!-- Search panel contents --}}
{{!-- actions.search and actions.export are defined for you to use in this section appropriately--}}
</FwPaginationWrapper>
Block form:
<FwPaginationWrapper @modelName="myModel" @defaultSortKey="sortKey" @makeQuery={{action "makeQuery"}} @getTitle={{action "getTitle"}} as |actions table|>
{{#unless table}}
{{!-- Search panel contents --}}
{{!-- actions.search and actions.export are defined for you to use in this section appropriately--}}
{{else}}
{{!-- Table component invocation --}}
{{!-- actions.sort and table.title, table.suffix, table.entries, and table.sortKey are defined for you to use in this section appropriately--}}
{{/unless}}
</FwPaginationWrapper>
Methods
Properties
- count
- currentEntries
- currentSortKey
- currentTitle
- defaultSortKey
- deletePagePermission
- emptyText
- entriesPerPage
- filteredEntries
- fullTableTitle
- hideEmpty
- index
- lastQuery
- maxPageButtons
- modelName
- page
- pageEntries
- pagesSearching
- routeName
- searchingTable
- searchOnRender
- showExport
- showPages
- showPagesBottom
- showPagesTop
- tableActions
- tableSortKey
- tableSuffix
- tableWrapperClass
- totalPages
Called to delete the full page of entries. Should be passed in with a function. Button will only appear if this is defined
This action is called when the export button is clicked to export all data. This is yielded in the block as actions.export
.
Returns:
Promise that resolves after exporting the table
Gets a list of table columns for exporting
Returns:
Array of table columns
Gets a list of table columns for the results. If null, yields for table
Returns:
Array of table columns
Gets the title of this table at the given time
Returns:
Title of this table
-
count
-
page
-
export
Makes a query object based on the search fields
Parameters:
Returns:
Query object
Gets all entries for the given query. Internal method
Returns:
Promise that resolves to entries
Queries the serverside to get the total record count. Internal method.
Returns:
Promise that resolves to a number
-
page
Fetches the entries for the given page number. Internal method
Parameters:
-
page
NumberPage to fetch
Returns:
Promise that resolves to an entry array
-
page
-
sortKey
-
ascending
Query for settign a new sort order. Internal method.
Parameters:
Returns:
Promise that resolves to a entry array
This action is called when the search button is pressed. This is yielded as actions.search
in the block.
Returns:
Promise that resolves after searching
-
page
This action is called when a page button is clicked to switch pages. This is an internal action used in the page number button.
Parameters:
-
page
NumberNew page number to set
-
column
-
sortKey
This action resorts the entry by the given column. This is yielded as actions.sort
, when table is also defined. To be used in the onSort
of your FwSortableTable
.
Parameters:
-
column
ColumnColumn to use for sorting
-
sortKey
StringString to use for sorting in the column
Returns:
Promise that resolves to entries
currentSortKey
String privateCurrent sort order for the table. Internal property to keep track of current sort key.
deletePagePermission
BooleanDetermines permission for deleteTablePermission for FwTableSortable
. Should probably use a has-role
helper from Group Control
Default: true
page
Number privateCurrently selected page. Internal property to be set by clicking one of the page numbers.
Default: 1
pageEntries
Array privateArray of entries, indexes are the pages. Internal Property for more quickly rendering pages that have been searched this time.
searchingTable
Boolean privateIf true, currently doing the main search. Internal property set by search functionality.
Default: false
searchOnRender
BooleanWhether or not the table loads on page load. If true, it will call the search based on your defaults already set, whenever the table is rendered for the first time.
Default: false
showPagesBottom
BooleanShow the page numbers below the table. If false, they won't show.
Default: true
showPagesTop
BooleanShow the page numbers above the table. If false, they won't show.
Default: true