new Paging(table) → {FooTable.Filtering}
The paging component adds a pagination control to the table allowing users to navigate table rows via pages.
Parameters:
Name | Type | Description |
---|---|---|
table |
FooTable.Table | The parent FooTable.Table object for the component. |
Returns:
- Type
- FooTable.Filtering
Extends
Members
-
$cell :jQuery
-
The jQuery cell object that contains the pagination control and total count.
Type:
-
$count :jQuery
-
The jQuery object that contains the row count.
Type:
-
$pagination :jQuery
-
The jQuery object that contains the links for the pagination control.
Type:
-
$row :jQuery
-
The jQuery row object that contains all the paging specific elements.
Type:
-
<private> _createdLinks :number
-
Used to hold the number of page links created.
Type:
- number
-
countFormat :string
-
The format string used to generate the text displayed under the pagination control.
Type:
- string
-
current :number
-
The current page number to display.
Type:
- number
-
detached :boolean
-
Whether or not the pagination row is detached from the table.
Type:
- boolean
-
enabled :boolean
-
Whether or not this component is enabled. Disabled components only have there preinit method called allowing for this value to be overridden.
Type:
- boolean
- Inherited From:
-
formattedCount :string
-
The count string generated using the FooTable.Filtering#countFormat option. This value is only set after the first call to the FooTable.Filtering#predraw method.
Type:
- string
-
ft :FooTable.Table
-
The parent FooTable.Table for the component.
Type:
- Inherited From:
-
limit :number
-
The maximum number of page links to display at once.
Type:
- number
-
position :string
-
The position of the pagination control within the paging rows cell.
Type:
- string
-
previous :number
-
A number indicating the previous page displayed.
Type:
- number
-
size :number
-
The number of rows to display per page.
Type:
- number
-
strings :Object
-
An object containing the strings used by the paging buttons.
Type:
- Object
-
total :number
-
The total number of pages.
Type:
- number
-
totalRows :number
-
The number of rows in the FooTable.Rows#array before paging is applied.
Type:
- number
Methods
-
<protected> $create()
-
Creates the paging UI from the current options setting the various jQuery properties of this component.
-
<private> _countFormat(currentPage, totalPages, pageFirst, pageLast, totalRows)
-
Uses the countFormat option to generate the text using the supplied parameters.
Parameters:
Name Type Description currentPage
number The current page. totalPages
number The total number of pages. pageFirst
number The first row number of the current page. pageLast
number The last row number of the current page. totalRows
number The total number of rows. -
<private> _createLinks()
-
Creates the pagination links using the current state of the plugin. If the total number of pages is the same as the last time this function was executed it does nothing.
-
<private> _onPageClicked(e)
-
Handles the click event for all links in the pagination control.
Parameters:
Name Type Description e
jQuery.Event The event object for the event. -
<private> _set(page) → {jQuery.Promise}
-
Performs the required steps to handle paging including the raising of the FooTable.Paging#"before.ft.paging" and FooTable.Paging#"after.ft.paging" events.
Parameters:
Name Type Description page
number The page to set. Fires:
Returns:
- Type
- jQuery.Promise
-
<private> _setNavigation(active)
-
Sets the state for the navigation links of the pagination control and optionally sets the active class state on the current page link.
Parameters:
Name Type Description active
boolean Whether or not to set the active class state on the individual page links. -
<private> _setVisible(page, right)
-
Sets the visible page using the supplied parameters.
Parameters:
Name Type Description page
number The page to make visible. right
boolean If set to true the supplied page will be the right most visible pagination link. -
<protected> destroy()
-
Destroys the paging component removing any UI generated from the table.
Fires:
-
<protected> draw()
-
Updates the paging UI setting the state of the pagination control.
-
first() → {jQuery.Promise}
-
Pages to the first page.
Fires:
Returns:
- Type
- jQuery.Promise
-
goto(page) → {jQuery.Promise}
-
Pages to the specified page.
Parameters:
Name Type Description page
number The page number to go to. Fires:
Returns:
- Type
- jQuery.Promise
-
<protected> init()
-
Initializes the paging component for the plugin using the supplied table and options.
Fires:
-
last() → {jQuery.Promise}
-
Pages to the last page.
Fires:
Returns:
- Type
- jQuery.Promise
-
next() → {jQuery.Promise}
-
Pages to the next page.
Fires:
Returns:
- Type
- jQuery.Promise
-
nextPages()
-
Shows the next X number of pages in the pagination control where X is the value set by the FooTable.Defaults#paging - limit option value.
-
pageSize(value) → {number|undefined}
-
Gets or sets the current page size
Parameters:
Name Type Argument Description value
number <optional>
The new page size to use. Returns:
- Type
- number | undefined
-
<protected> postdraw()
-
This method is called from the FooTable.Table#draw method.
- Inherited From:
-
<protected> predraw()
-
Performs the actual paging against the FooTable.Rows#current array removing all rows that are not on the current visible page.
-
<protected> preinit(data)
-
Checks the supplied data and options for the paging component.
Parameters:
Name Type Description data
object The jQuery data object from the parent table. Fires:
-
prev() → {jQuery.Promise}
-
Pages to the previous page.
Fires:
Returns:
- Type
- jQuery.Promise
-
prevPages()
-
Shows the previous X number of pages in the pagination control where X is the value set by the FooTable.Defaults#paging - limit option value.