# Class: ListRenderer

## jala.ListRenderer(coll, renderer)

#### new ListRenderer(coll, renderer)

##### Parameters:

Name | Type | Description
--- | --- | ---
`coll` | HopObject | ArrayList | Array | The collection this ListRenderer operates on, or - for backwards compatibility only - a parameter object containing the collection and any other optional configuration parameters.
`renderer` | Object | An optional renderer to use. If this is set, any rendering method defined in this renderer overrides the default renderer.

Source:
  - jala/code/ListRenderer.js, line 50

### Classes

ArrayList

### Members

#### (static, readonly) defaultRenderer

Default Renderer object containing functions used for rendering different list items (eg. page navigation, prev/next links and list items).

Source:
  - jala/code/ListRenderer.js, line 942

### Methods

#### currentEnd_macro()

Returns the end item number in the current page

Source:
  - jala/code/ListRenderer.js, line 906

##### Returns:

The end item number in the current page

#### currentPage_macro()

Returns the current page number

Source:
  - jala/code/ListRenderer.js, line 888

##### Returns:

The current page number

#### currentStart_macro()

Returns the start item number in the current page

Source:
  - jala/code/ListRenderer.js, line 897

##### Returns:

The start item number in the current page

#### getBaseHref()

Returns the base href of this ListRenderer instance

Source:
  - jala/code/ListRenderer.js, line 298

##### Returns:

The base href of this ListRenderer instance

#### getCollection()

Returns the collection this ListRenderer instance operates on

Source:
  - jala/code/ListRenderer.js, line 132

##### Returns:

The collection of this ListRenderer

#### getCurrentPage()

Returns the current page index. This is either the page url parameter or the page number 1.

Source:
  - jala/code/ListRenderer.js, line 180
See:
  - #setUrlParameterName

##### Returns:

The current page number (starts with 1).

#### getEndIndex()

Returns the zero-based index position of the last item of the current page in the collection this ListRenderer operates on.

Source:
  - jala/code/ListRenderer.js, line 479

##### Returns:

The index position of the last item in the list

#### getItemSkin()

Returns the name of the skin rendered for a single list item

Source:
  - jala/code/ListRenderer.js, line 319

##### Returns:

The name of the list item skin

#### getList(param)

Returns the rendered list of collection items as string

##### Parameters:

Name | Type | Description
--- | --- | ---
`param` | Object | Object containing extra parameters (e.g. from a macro call).

Source:
  - jala/code/ListRenderer.js, line 579
See:
  - #renderList

##### Returns:

The rendered list

#### getMaxDayDate()

Gets the Date offset indicated by parameter maxDays as Number for runtime efficent comparison

Source:
  - jala/code/ListRenderer.js, line 232

#### getMaxDays()

Returns the maximum number of days handled by this ListRenderer instance

Source:
  - jala/code/ListRenderer.js, line 213

##### Returns:

The maximum number of days

#### getMaxPages()

Returns the maximum number of pages handled by this ListRenderer instance

Source:
  - jala/code/ListRenderer.js, line 193

##### Returns:

The maximum number of pages

#### getNextItem() → {Object}

Source:
  - jala/code/ListRenderer.js, line 243

##### Returns:

the next Item

Type
  Object

#### getNextLink(param)

Returns a rendered link to the previous page as string. For performance reasons this method caches the rendered link in the local cache of this ListRenderer instance.

##### Parameters:

Name | Type | Description
--- | --- | ---
`param` | Object | Object containing extra parameters (e.g. from a macro call).

Source:
  - jala/code/ListRenderer.js, line 661
See:
  - #renderNextLink

##### Returns:

A rendered link to the previous page

#### getPageHref(page)

Returns the href of a page. If no argument is given, the href of the current page is returned. Any URL parameters set with #setUrlParameters are added to the href.

##### Parameters:

Name | Type | Description
--- | --- | ---
`page` | Number | The optional page number to include in the href.

Source:
  - jala/code/ListRenderer.js, line 443
See:
  - #setUrlParameters
  - #setUrlParameterName

##### Returns:

The href of the page

#### getPageNavigation(param)

Returns the rendered page navigation bar as string

##### Parameters:

Name | Type | Description
--- | --- | ---
`param` | Object | Object containing extra parameters (e.g. from a macro call).

Source:
  - jala/code/ListRenderer.js, line 777
See:
  - #renderPageNavigation

##### Returns:

The rendered page navigation

#### getPageSize()

Returns the number of items displayed on one page

Source:
  - jala/code/ListRenderer.js, line 158

##### Returns:

The number of items displayed on a single page

#### getPrevLink(param)

Returns a rendered link to the previous page as string. For performance reasons this method caches the rendered link in the local cache of this ListRenderer instance.

##### Parameters:

Name | Type | Description
--- | --- | ---
`param` | Object | Object containing extra parameters (e.g. from a macro call).

Source:
  - jala/code/ListRenderer.js, line 616
See:
  - #renderPrevLink

##### Returns:

A rendered link to the previous page

#### getRenderer()

Returns the renderer used by this ListRenderer instance

Source:
  - jala/code/ListRenderer.js, line 380

#### getStartIndex()

Returns the zero-based index position of the first item of the current page in the collection this ListRenderer operates on.

Source:
  - jala/code/ListRenderer.js, line 469

##### Returns:

The index position of the first item in the list

#### getTotalPages()

Returns the total number of pages handled by this ListRenderer instance (which is the collection size divided by the page size).

Source:
  - jala/code/ListRenderer.js, line 284

##### Returns:

The total number of pages

#### getUrlParameterName()

Returns the name of the URL parameter name containing the index of the page to display

Source:
  - jala/code/ListRenderer.js, line 340

##### Returns:

The name of the page URL parameter name

#### getUrlParameters()

Returns any additional URL parameters included in every navigation link rendered by this ListRenderer instance.

Source:
  - jala/code/ListRenderer.js, line 362

##### Returns:

A string containing additional URL parameters

#### hasNext() → {Boolean}

Source:
  - jala/code/ListRenderer.js, line 258

##### Returns:

wether there is a next item

Type
  Boolean

#### limit_macro(param)

Either renders the maximum number of items per page, or sets the limit to a given number.

##### Parameters:

Name | Type | Description
--- | --- | ---

`param`

Object

Extra macro parameters:

- to - The maximum number of items per page to be set.

If no limit is set, this macro returns the current number of items per page.

Source:
  - jala/code/ListRenderer.js, line 812

##### Returns:

The current maximum number of items per page

#### nextLink_macro(param)

Returns a rendered link to the next page.

##### Parameters:

Name | Type | Description
--- | --- | ---

`param`

Object

Extra macro parameters:

- type - The type of renderer to be applied.

Source:
  - jala/code/ListRenderer.js, line 845
See:
  - #renderNextLink

##### Returns:

A rendered link to the next page

#### pageNavigation_macro(param)

Returns the rendered page navigation bar.

##### Parameters:

Name | Type | Description
--- | --- | ---

`param`

Object

Extra macro parameters:

- type - The type of renderer to be applied.

Source:
  - jala/code/ListRenderer.js, line 859
See:
  - #getPageNavigation

##### Returns:

The rendered page navigation bar

#### prevLink_macro(param)

Returns a rendered link to the previous page.

##### Parameters:

Name | Type | Description
--- | --- | ---

`param`

Object

Extra macro parameters:

- type - The type of renderer to be applied.

Source:
  - jala/code/ListRenderer.js, line 831
See:
  - #renderPrevLink

##### Returns:

A rendered link to the previous page

#### renderList(param)

Renders the list of items for one page directly to response.

##### Parameters:

Name | Type | Description
--- | --- | ---
`param` | Object | Object containing extra parameters (e.g. from a macro call).

Source:
  - jala/code/ListRenderer.js, line 526
See:
  - #getList

#### renderListAsString(param)

Returns the rendered list of collection items as string

##### Parameters:

Name | Type | Description
--- | --- | ---
`param` | Object | Object containing extra parameters (e.g. from a macro call).

Deprecated:
  - Use #getList instead
Source:
  - jala/code/ListRenderer.js, line 593
See:
  - #renderList

##### Returns:

The rendered list

#### renderNextLink(param)

Renders a link to the next page directly to response.

##### Parameters:

Name | Type | Description
--- | --- | ---
`param` | Object | Object containing extra parameters (e.g. from a macro call).

Source:
  - jala/code/ListRenderer.js, line 647
See:
  - #getNextLink

#### renderNextLinkAsString()

Returns a rendered link to the previous page as string

Deprecated:
  - Use #getNextLink instead
Source:
  - jala/code/ListRenderer.js, line 694

##### Returns:

A rendered link to the next page

#### renderPageNavigation(param)

Renders the page navigation bar directly to response. For performance reasons this method caches the rendered page navigation in the local cache of this ListRenderer instance.

##### Parameters:

Name | Type | Description
--- | --- | ---
`param` | Object | Object containing extra parameters (e.g. from a macro call).

Source:
  - jala/code/ListRenderer.js, line 705
See:
  - #getPageNavigation

#### renderPageNavigationAsString()

Returns the rendered page navigation bar as string

Deprecated:
  - Use #getPageNavigation instead
Source:
  - jala/code/ListRenderer.js, line 789

##### Returns:

The rendered page navigation bar

#### renderPrevLink(param)

Renders a link to the previous page directly to response.

##### Parameters:

Name | Type | Description
--- | --- | ---
`param` | Object | Object containing extra parameters (e.g. from a macro call).

Source:
  - jala/code/ListRenderer.js, line 602
See:
  - #getPrevLink

#### renderPrevLinkAsString(param)

Returns a rendered link to the previous page as string

##### Parameters:

Name | Type | Description
--- | --- | ---
`param` | Object | Object containing extra parameters (e.g. from a macro call).

Deprecated:
  - Use #getPrevLink instead
Source:
  - jala/code/ListRenderer.js, line 638

##### Returns:

A rendered link to the previous page

#### render_macro(param)

Renders the current page of this list.

##### Parameters:

Name | Type | Description
--- | --- | ---

`param`

Object

Extra macro parameters:

- skin - The name of the list skin to render for each item in the list.
- type - The type of renderer to be applied.

Source:
  - jala/code/ListRenderer.js, line 919
See:
  - #renderList

#### setBaseHref(href)

Sets the base href of this ListRenderer instance. All links rendered will start with the href passed as argument

##### Parameters:

Name | Type | Description
--- | --- | ---
`href` | String | The base href to use for rendering links

Source:
  - jala/code/ListRenderer.js, line 307

#### setCollection(coll)

Sets the collection of this ListRenderer

##### Parameters:

Name | Type | Description
--- | --- | ---
`coll` | HopObject | ArrayList | Array | The collection this ListRenderer instance should operate on

Source:
  - jala/code/ListRenderer.js, line 141

#### setItemSkin(name)

Sets the name of the skin to render for every list item

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | The name of the skin to render for every list item

Source:
  - jala/code/ListRenderer.js, line 327

#### setMaxDays(days)

Sets the maximum number of days to display

##### Parameters:

Name | Type | Description
--- | --- | ---
`days` | Number | The maximum number of days to display

Source:
  - jala/code/ListRenderer.js, line 221

#### setMaxPages(pages)

Sets the maximum number of pages to display

##### Parameters:

Name | Type | Description
--- | --- | ---
`pages` | Number | The maximum number of pages to display

Source:
  - jala/code/ListRenderer.js, line 201

#### setPageSize(size)

Sets the number of items to display on a single page

##### Parameters:

Name | Type | Description
--- | --- | ---
`size` | Number | The number of items to display on one page

Source:
  - jala/code/ListRenderer.js, line 166

#### setRenderer(r)

Sets the renderer to be used by this ListRenderer instance

##### Parameters:

Name | Type | Description
--- | --- | ---
`r` | Object | The renderer to use

Source:
  - jala/code/ListRenderer.js, line 388

#### setUrlParameterName(name)

Sets the name of the URL parameter name containing the index of the page to display

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | The name of the page URL parameter

Source:
  - jala/code/ListRenderer.js, line 349

#### setUrlParameters(params)

Sets additional parameters to include in every navigation link

##### Parameters:

Name | Type | Description
--- | --- | ---
`params` | String | A string to append to every navigation URL

Source:
  - jala/code/ListRenderer.js, line 370

#### size_macro()

Returns the total number of items

Source:
  - jala/code/ListRenderer.js, line 869

##### Returns:

The total number of items in the collection this ListRenderer instance is working on

#### totalPages_macro()

Returns the total number of pages

Source:
  - jala/code/ListRenderer.js, line 879

##### Returns:

The total number of pages available