Class Pagination

The pagination widget can be used to provide UI to
break up large amount of data into pages.

Part of:

package weblocks, class widget

Direct Superclass

widgetBase class for all widget objects.

Slot

continuation
Stores the continuation object for widgets that were invoked via one of the do-* functions ('do-page', etc.). When 'answer' is called on a widget, this value is used to resume the computation.
Accessors:widget-continuation.
current-page
The number of the currently viewed page.
Initform:1, Initargs::current-page; Accessors:pagination-current-page.
items-per-page
Number of data items that are displayed on each page. This value defaults to *pagination-items-per-page*.
Initform:*pagination-items-per-page*, Initargs::items-per-page; Accessors:pagination-items-per-page.
last-request-error-p
Used an an intermediary flag to determine if the last request resulted in an error.
name
A name of the widget used in rendering CSS classes. If the name is not provided it will be generated automatically with 'generate-widget-id'.
Initform:(generate-widget-id), Initargs::name; Accessors:widget-name.
on-change
An optional callback function that will be called by the pagination widget when the currently viewed page is changed by the user. The function must accept three arguments: the pagination widget, starting item index (inclusive), and ending item index (exclusive).
Initargs::on-change; Accessors:pagination-on-change.
on-error
Because the pagination widget allows inputting the page number to go to, there are potential errors that need to be handled (invalid page, etc.) Pagination widget expects 'on-error' to be bound to a flash widget (in which case it will be used to notify the user of an error), or a function of one argument (error message) that can handle the error in a custom manner. If 'on-error' is bound to anything else the client of the widget will not be notified of an error. In all cases, pagination widget will apply 'item-not-validated' class to the input field.
Initargs::on-error; Accessors:pagination-on-error.
propagate-dirty
A list of widget paths (see 'find-widget-by-path') or widgets each of which will be made dirty when this widget is made dirty via a POST request. This slot allows setting up dependencies between widgets that will make multiple widgets update automatically during AJAX requests.
Initargs::propagate-dirty; Accessors:widget-propagate-dirty.
renderedp
This slot holds a boolean flag indicating whether the widget has been rendered at least once. Because marking unrendered widgets as dirty may cause JS problems, 'mark-dirty' will use this flag to determine the status of a widget.
Accessors:widget-rendered-p.
show-total-items-p
If true (default) allows showing total number of items to the user.
Initform:t, Initargs::show-total-items-p; Accessors:pagination-show-total-items-p.
total-items
Total number of data items managed by this pagination widget. Note, if the number of items is zero (the default), the pagination widget will not render pagination UI.
Initform:0, Initargs::total-items; Accessors:pagination-total-items.
widget-prefix-fn
A function called prior to rendering the widget body. The function should expect the widget as well as any additional arguments passed to the widget.
Initargs::widget-prefix-fn; Accessors:widget-prefix-fn.
widget-suffix-fn
A function called after rendering the widget body. The function should expect the widget as well as any additional arguments passed to the widget.
Initargs::widget-suffix-fn; Accessors:widget-suffix-fn.

Direct Method

pagination-render-total-item-countThis function is responsible for rendering the total number of
items if 'show-total-items' is set...
render-widget-bodyA generic function that renders a widget in its current state. In
order to actually render the wi...
setfpagination-items-per-page
setfpagination-total-items

Other Method

composite-widgets
find-widget-by-path*Returns a widget object located at 'path', where 'path' is a list
of widget names starting from r...
mark-dirtyDefault implementation adds a widget to a list of dirty
widgets. Normally used during an AJAX req...
widget-css-classesReturns a string that represents applicable CSS
classes for 'widget'. Normally includes the class...