Pager

Pager

new Pager(optionsopt)

Source:
Properties:
Name Type Attributes Default Description
options.position String <optional>
"top"

The position of the Navigation. Can either be top, right, left or bottom.

options.show Integer <optional>

The page to show. Set to -1 to hide all pages.

options.pages Array.<(Container|DOMNode|String)> <optional>
[]

An array of either an instance of Container (or derivate), a DOMNode or a string of HTML which gets wrapped in a new Container.

Pager, also known as Notebook in other UI toolkits, provides multiple containers for displaying contents via Pages which are switchable via a Navigation.

Example
var pager = new Pager({
 pages: [
  {
    label: "Empty Page 1",
    content: document.createElement("span")
  },
  {
    label: { label:"Foobar", class:"foobar" },
    content: "<h1>Foobar</h1><p>Lorem ipsum dolor sit amet</p>"
  }
 ]
});
Parameters:
Name Type Attributes Default Description
options Object <optional>
{ }

An object containing initial options.

Extends

Members

element

Source:
Overrides:

The main DIV element. Has the class .aux-pager.

Source:

The Navigation instance acting as the menu.

pages

Source:

The Pages instance.

Methods

addChild(child)

Source:
Overrides:
See:

Registers a widget as a child widget. This method is used to build up the widget tree. It does not modify the DOM tree.

Parameters:
Name Type Description
child Widget

The child to add.

Fires:
  • Widget#event:child_added

addChildren(a)

Source:
Inherited From:

Registers an array of widgets as children.

Parameters:
Name Type Description
a Array.<Widget>

An array of Widgets.

addPage(buttonOptions, content, optionsopt, positionopt)

Source:

Adds a Container to the pager and a corresponding Button to the pagers Navigation.

Parameters:
Name Type Attributes Default Description
buttonOptions string | Object

A string with the Buttons label or an object containing options for the Button instance.

content Container | DOMNode | string

The content of the page. Either a Container (or derivate) widget, a DOMNode or a string of HTML which gets wrapped in a new Container using options from argument options.

options Object <optional>
{ }

An object containing options for the Container to be added as page if content is either a string or a DOMNode.

position integer | undefined <optional>

The position to add the new page to. If undefined, the page is added at the end.

Fires:

addPages(options)

Source:

Adds an array of pages.

Example
var p = new Pager();
p.addPages([
  {
    label: "Page 1",
    icon: "gear",
    content: "<h1>Page1</h1>",
  }
]);
Parameters:
Name Type Description
options Array.<Object>

An Array of objects with members content and all options available in Button. content is either a Container (or derivate) widget, a DOMNode or a string of HTML which gets wrapped in a new Container with options from argument options.

allChildren()

Source:
Inherited From:

Returns an array of all children.

appendChild(child)

Source:
Inherited From:

Appends child.element to the widget element and registers child as a child widget.

Parameters:
Name Type Description
child Widget

The child widget to append.

appendChildren(children)

Source:
Inherited From:

Calls Widget#appendChild for an array of widgets.

Parameters:
Name Type Description
children Array.<Widget>

The child widgets to append.

current()

Source:

Returns the currently displayed page or null.

destroy()

Source:
Inherited From:

Dispose of this Widget.

destroyAndRemove()

Source:
Inherited From:

Dispose of this Widget and remove it from the DOM.

disableTansitions()

Source:
Inherited From:

Disable CSS transitions.

enableDraw()

Source:
Inherited From:

Schedules this widget for drawing.

Fires:

enableDrawChildren()

Source:
Inherited From:

Enables rendering for all children of this widget.

enableTransitions()

Source:
Inherited From:

Enable CSS transitions.

first()

Source:

Opens the first page of the pager. Returns true if a first page exists, false otherwise.

forceHide()

Source:
Inherited From:

Hide the widget immediately by applying the class aux-hide. Does not call disableDraw().

forceShow()

Source:
Inherited From:

Show the widget immediately by applying the class aux-show. Does not call enableDraw().

getStyle()

Source:
Inherited From:

Returns the computed style of this widget's DOM element.

hidden()

Source:
Inherited From:

Returns the current hidden status.

hide()

Source:
Inherited From:

Starts the transition of the visible to false.

hideChild(child)

Source:
Inherited From:

Switches the hidden state of a child to hidden. The argument is either the child index or the child itself.

Parameters:
Name Type Description
child Object | integer

Child or its index.

invalidate(key)

Source:
Inherited From:

Invalidates an option and triggers a redraw() call.

Parameters:
Name Type Description
key string

invalidateAll()

Source:
Inherited From:

Invalidates all dependencies which will trigger all renderers to rerun.

isChildHidden(child) → {boolean}

Source:
Inherited From:

Returns true if the given child is currently marked as hidden in this container.

Parameters:
Name Type Description
child number | Widget
Returns:
Type
boolean

last()

Source:

Opens the last page of the pager. Returns true if a last page exists, false otherwise.

next()

Source:

Opens the next page of the pager. Returns true if a next page exists, false otherwise.

observeResize(cb)

Source:
Inherited From:

Calls a callback whenever the widget resizes. This method will trigger one resize.

Parameters:
Name Type Description
cb function

prev()

Source:

Opens the previous page of the pager. Returns true if a previous page exists, false otherwise.

removeChild(child)

Source:
Overrides:

Removes a child widget. Note that this method only modifies the widget tree and does not change the DOM.

Parameters:
Name Type Description
child Widget

The child to remove.

Fires:
  • Widget#event:child_removed

removeChildren(a)

Source:
Inherited From:

Removes an array of children.

Parameters:
Name Type Description
a Array.<Widget>

An array of Widgets.

removePage(page)

Source:

Removes a page from the Pager.

Parameters:
Name Type Description
page integer | Container

The container to remove. Either an index or the Container widget generated by addPage.

Fires:

set(key, value)

Source:
Inherited From:

Sets an option.

Parameters:
Name Type Description
key string

The option name.

value

The option value.

setStyle()

Source:
Inherited From:

Sets a CSS style property in this widget's DOM element.

show()

Source:
Inherited From:

Starts the transition of the visible to true.

showChild(child)

Source:
Inherited From:

Switches the hidden state of a child to shown. The argument is either the child index or the child itself.

Parameters:
Name Type Description
child Object | integer

Child or its index.

toggleChild(child)

Source:
Inherited From:

Toggles the hidden state of a child. The argument is either the child index or the child itself.

Parameters:
Name Type Description
child Object | integer

Child or its index.

toggleHidden()

Source:
Inherited From:

Toggle the hidden status. This is equivalent to calling hide() or show(), depending on the current hidden status of this widget.

transitionsDisabled()

Source:
Inherited From:

Returns true if transitions are currently disabled on this widget.

visibleChildren()

Source:
Inherited From:

Returns an array of all visible children.

Events

added

Source:

A page was added to the Pager.

Parameters:
Name Type Description
page Container

The Container which was added as a page.

destroy

Source:
Inherited From:

Is fired when a widget is destroyed.

doubleclick

Source:
Inherited From:

Is fired after a double click appeared. Set dblclick to 0 to disable click event handling.

Parameters:
Name Type Description
event string

The browsers MouseEvent.

GenericDOMEvents

Source:
Inherited From:

Generic DOM events. Please refer to W3Schools for further details.

hide

Source:
Inherited From:

The hide event is emitted when a widget is hidden and is not rendered anymore. This happens both with browser visibility changes and also internally when using layout widgets such as Pager.

initialized

Source:
Inherited From:

Is fired when a widget is initialized.

removed

Source:

A page was removed from the Pager

Parameters:
Name Type Description
page Container

The Container which was removed.

resize

Source:
Inherited From:

The resize event is emitted whenever a widget is being resized. This event can be used to e.g. measure its new size. Note that some widgets do internal adjustments after the resize event. If that is relevant, the Widget#resized event can be used instead.

resized

Source:
Inherited From:

The resized event is emitted after each rendering frame, which was triggered by a resize event.

set

Source:
Inherited From:

The set event is emitted when an option was set using the Widget#set method. The arguments are the option name and its new value.

Note that this happens both for user interaction and programmatical option changes.

show

Source:
Inherited From:

The show event is emitted when a widget is shown and is being rendered. This is the counterpart to Widget#hide.

useraction

Source:

The useraction event is emitted when a widget gets modified by user interaction. The event is emitted for the option show.

Parameters:
Name Type Description
name string

The name of the option which was changed due to the users action

value mixed

The new value of the option

visibility

Source:
Inherited From:

Is fired when the visibility state changes. The first argument is the visibility state, which is either true or false.