ludo.ListView

ludo.


new ludo.ListView(config)

ListView
Class rendering an array of JSON objects in a list.

For demo, see list.php

The list view depends on a collection data source. To update items in the list view during runtime,
update the datasource. To remove items from the list view, remove the item from the data source.

Parameters:
Name Type Description
config Object
Properties
Name Type Description
swipable Boolean

True to support swiping of items to the left and/or right

itemRenderer function

Function returning HTML for a list item. You may skip the renderer by creating a string template(tpl) instead

tpl String

Alternative to config.itemRenderer. This is a template string for all the records where you use curly braces to reference properties,
example: '

{firstname} {lastname}
'

backSideLeft function

Function returning html which is displayed behind the list item when swiping to the left(Optional)

backSideRight function

Function returning html which is displayed behind the list item when swiping to the right(Optional)

backSideUndo function

Optional function returning html for the undo which may be displayed after swiping. On click the swipe
will be undone and the list item displayed as normal. If backSideUndo is defined, the swipe events(swipeLeft, swipeRight and swipe) will not
be triggered until the config.undoTimeout has elapsed.

Source:
Fires:
  • ludo.ListView#swipe Fired after swiping left or right.event: Arguments: 1) JSON Object/record
  • ludo.ListView#swipeRight Fired after swiping right.event: Arguments: 1) JSON Object/record
  • ludo.ListView#swipeLeft Fired after swiping left.event: Arguments: 1) JSON Object/record

Methods


undoSwipe(record)

Undo swipe. This method can be called when the list item is swiped to the left
or right. It cannot be called after a record has been removed from the data source
using dataSource.remove.

Parameters:
Name Type Description
record Object | String

record object or record.uid(unique id)

Source: