|
fluid.pager(container, options); |
The container
parameter is is a selector, a single-element jQuery, or a DOM element specifying the root DOM node of the Pager markup.
The options
parameter is an optional collection of name-value pairs that configure the Pager, as described below in the Options section.
The Pager component fires the following event:
Event |
Type |
Description |
Parameters |
Parameter Description |
---|---|---|---|---|
|
default |
Fired whenever the pager's "model" changes - that is, whenever there is a change to the displayed range of data for the pager, caused by a change to the page index, page size or underlying data |
|
|
In addition, in this release, the Pager also supports the following events, which are however implementation-specific, and part of a transitional implementation strategy before the adoption of the Data Binder and BeanInvalidationModel:
Event |
Type |
Description |
Parameters |
Parameter Description |
---|---|---|---|---|
|
default |
Fired when the implementation wishes to initiate the change of state corresponding to the selection of a new page |
|
A structure which includes either the member |
|
default |
Fired when the implementation wishes to initiate the change of state corresponding to an updated page size for the visible range |
newPageSize |
an integer representing the desired new page size |
that
organizationWhere the component that
is constructed by a line such as
var that = fluid.pager(component, options); |
, the returned object will have the following top-level organisation in terms of subcomponents and model:
that.model |
The "model" of the pager - note to distinguish carefully between the pager's model, and the data model of the user. The pager's model consists of the state of the paging component, which specifies the page index position, overall data range and page size. The user's data model consists of the actual data being paged, which is stored in that.options.dataModel
. This, the pager's model, should be treated as read-only via this interface, and should only be manipulated by use of the component's event system.
The pager model is laid out as following:
Field |
Type |
Primary/Computed |
Description |
||
---|---|---|---|---|---|
pageIndex |
integer |
Primary |
The current index of the page, expressed 0-based amongst the range of pages |
||
pageSize |
integer |
Primary |
The number of "items" which may be shown on a page |
||
totalRange |
integer |
Primary |
The total count of "items" in the underlying user's data model |
||
pageCount |
integer |
Computed |
The limit of the range in which pageIndex is expressed |
||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f5204111-88e5-41fe-b6b8-9245647a28d5"><ac:plain-text-body><![CDATA[ |
[pageLimit] |
integer |
Computed |
The limit of the range of items shown on the current page represented by the model |
]]></ac:plain-text-body></ac:structured-macro> |
(pageLimit is not actually stored within the model at any point, but is supplied a computation function computePageLimit
to match computePageCount
by which pageCount
is derived from the primary fields.
The following options to the creator function can be used to customize the behaviour of the Pager component:
Name |
Description |
Values |
Default |
|
---|---|---|---|---|
|
Javascript object containing selectors for various fragments of the Pager component. |
The object may contain any subset of the following keys: |
|
|
|
Javascript object containing CSS style names that will be applied to the Pager component. |
The object may contain any subset of the following keys: |
|
|
|
A function that will be called each time a new page has been selected. This function will most likely retrieve data for the selected page, or otherwise update the data. |
a function |
|
The Pager dependencies can be met by including the minified Fluid-all.js
file in the header of the HTML file:
<script type="text/javascript" src="Fluid-all.js"></script> |
Alternatively, the individual file requirements are:
<script type="text/javascript" src="jquery/jquery-1.2.6.js"></script> <script type="text/javascript" src="fluid/Fluid.js"></script> <script type="text/javascript" src="fluid/Pager.js"></script> |