Class: List

MobileAge.Component.List(dom, options)

List-Component

Constructor

new List(dom, options)

Class representing a single list component.
Parameters:
Name Type Description
dom string Id, css-query or a ElementNode to connect to.
options Object
Properties
Name Type Attributes Default Description
templateListWrapper String <optional>
<ul><%%></ul> HTML template used for the list element. The template must include the anonym placeholder "<%%>", which will be filled with the resulted list items.
templateListItemWrapper String <optional>
<li><%%></li> HTML template used for every single list item. The template must include placeholders, which will be filled with the requested data. If the response data is an one-dimensional array, the template must use the anonym placeholder "<%%>". If the response data is an associative array, the template must used named placeholder like "<%name%>", where "name" is the index of the response array.
templateListItem String <optional>
"" HTML template used for every single item inside the templateListItemWrapper. The template must include placeholders, which will be filled with the requested data. If the response data is an one-dimensional array, the template must used the anonym placeholder "<%%>". If the response data is an associative array, the template must used named placeholder like "<%name%>", where "name" is the index of the response array.
autorequest Boolean <optional>
true Indicates if the first request should be sended during the initialisation of the list.
dataLimit String <optional>
"" Limits the printed list items to the stated amount
clientFiltering Boolean <optional>
false Indicates if the first results should be filtered after they are recieved and before they are printed.
clear Boolean <optional>
false Specifies, wether the content of the dom element is deleted before adding the list.
onTemplateListItem function <optional>
"" Callback-function called every time before list item will be printed. The functions parameter "data" contains the data assosiated with the item. The callback-funktion should return a template string.
onDataItem function <optional>
"" Callback-function called every time when the data for a list item should be prepared. The functions parameter "data" contains the data assosiated with the actual item. The callback-funktion should return a associative array representing the item's data. (default: null)
onSelect function <optional>
"" Callback-function called, when a list item is selected by touch, mouse-click or keyboard selection.
Source:

Extends

Classes

RestaurantsNearLocation

Methods

(static) _addItems(items)

Creates a List element with all received options
Parameters:
Name Type Description
items array array of List-options
Source:

(static) _create()

Creates a List-Component
Source:

(static) _createItem(item) → {node}

Creates and returns an list element with text
Parameters:
Name Type Description
item array array of item.text and item.id
Source:
Returns:
created DOM-Element
Type
node

(static) _createList(items)

Creates a List element with all received options
Parameters:
Name Type Description
items array array of List-options
Source:

(static) _createOkay()

creates a okay-message on the page
Source:

(static) _onRequestData(data)

Callback function called when requested data is received
Parameters:
Name Type Description
data object requested data
Source:

(static) _onRequestData(data)

Callback function called when requested data is received
Parameters:
Name Type Description
data object requested data _onRequestData: (data) -> if data and Array.isArray(data)
Source:

(static) replaceData(data)

Replaces the list data with given data
Parameters:
Name Type Description
data String | array
Source: