Creating instance
Rendering if not tied to an API or data is ready
Private method pages
Calculates the total pages
Returns a Number
(Total pages)
Private method range
Calculates the page size as an Array of start & finish
Returns an Array
(Array of start & end numbers)
Constructor
DataList factory
Setting constructor loop
Method dump
Exports data list records
Returns an Array
(Record set)
Method page
Changes the page index of the DataList
Parameters:
Returns an Object
(DataList instance)
Method pages
Adds pagination Elements to the View
Returns an Object
(DataList instance)
Removing the existing controls
Halting because there's 1 page, or nothing
Getting the range to display
Setting up the list
First page
Previous page
Rendering the page range
Next page
Last page
Adding to DOM
Click handler scrolls to top the top of page
Method refresh
Refreshes element Events: beforeDataListRefresh Fires from the element containing the DataList afterDataListRefresh Fires from the element containing the DataList
Parameters:
redraw must be a Boolean.
([Optional] Boolean to force clearing the DataList ( default ), false toggles "hidden" class of items)
create must be a Boolean.
([Optional] Recreates cached View of data)
Returns an Object
(DataList instance)
Function to create templates for the html rep
Replacing record key
Replacing dot notation properties
Filling in placeholder value
Replacing record key
Replacing dot notation properties
Stripping first and last " to concat to valid JSON
Filling in placeholder value
Consuming records based on sort
Resetting 'view' specific arrays
Filtering records (if applicable)
Pagination
Passed the end, so putting you on the end
Paginating the items
Processing records & generating templates
Preparing the target element
Rendering pagination elements
Method sort
Sorts data list & refreshes element
Parameters:
Returns an Object
(DataList instance)
Method teardown
Tears down references to the DataList
Parameters:
true
will remove the DataList from the DOM)Returns an Object
(DataList instance)
Method factory
Parameters:
target must be an Object.
(Element to receive the DataList)
store must be an Object.
(Data store to feed the DataList)
template can be of any type.
(Record field, template ( $.tpl ), or String, e.g. "
this is a {{field}} sample.
", fields are marked with {{ }})options must be an Object.
(Optional parameters to set on the DataList)
Returns an Object
(DataList instance)