Repeater List View repeater-list.js
The repeater list view plug-in will render data in a tabular format, with many options and methods to suit your needs.
Example
Usage
The repeater list plug-in extends repeater functionality. This plug-in follows the steps specified in the repeater docs. You can also use the following additional features:
Data Source
The dataSource function behaves as described in the repeater docs. However, the function potentially provides a few additional attributes in the options
argument:
Attribute | type | description |
---|---|---|
sortDirection | string | If the list view is sortable and has been sorted by the user, this will indicate the sort direction.
Values are either 'asc' or 'desc' . |
sortProperty | string | If the list view is sortable and has been sorted by the user, this will indicate the column property that has been sorted on. |
Additionally, the function requires a few additional parameters on the returned data
object to render the data properly:
Attribute | type | description |
---|---|---|
columns | array | Array of objects representing the desired columns within the rendered list. The column objects contain
three attributes:
[ { label: 'Name', property: 'name', sortable: true }, ... ] )
|
items | array | Array of objects representing the item data that will be displayed within the repeater. The item
objects can contain any number of attributes. The attribute name must match the column property value to display within a column.
|
Options
You can pass options via Javascript upon initialization.
Name | type | default | description |
---|---|---|---|
list_actions | object | null | Can be used to configure an additional actions column in the repeater. It will positioned as the rightmost column
and will always be visible. It creates a dropdown menu that can be populated with x number of actions to be applied
to the row. If multi select is also enabled will allow for bulk actions.
|
list_columnRendered | function | null | If set, the repeater calls this function after rendering each table cell within a row. It passes a helpers
object and a callback function as arguments. This function is the preferred way to modify table cell markup.
|
list_columnSizing | boolean | true | Dictates whether the repeater should run the intelligent column resizing algorithm. This feature only resizes columns without a set value. Setting this value to false will disable this feature entirely.
|
list_columnSyncing | boolean | true | Dictates whether the repeater should run the post-render column syncing algorithm. This feature keeps
the `.repeater-list-heading` classed divs in alignment with the columns. Setting this value to
false will disable this feature entirely.
|
list_frozenColumns | number | 0 | Dictates whether the repeater should create frozen columns in the repeater. This feature creates x number of frozen columns on the left side of the repeater. Frozen columns means that when scrolled left to right these columns will not move and always be visible. |
list_infiniteScroll | boolean or object | false | Dictates whether the repeater list view should utilize infinite scrolling instead of pagination.
A true value enables infinite scrolling with default settings. Additionally,
you can set this value to an object with attributes matching the options available in the
infinite scroll control. This option allows for further
customization and ignores the dataSource option.
|
list_noItemsHTML | string or jQuery object | '' | Specifies what is displayed if no items return from the dataSource. You can use a
string or jQuery object.
|
list_selectable | boolean or string | false | Specifies whether a user can select rendered item rows. If you set the value to true ,
users can select only one row at a time. If you set the value to 'multi' , users can select multiple rows at once.
|
list_sortClearing | boolean | false | Specifies whether users can clear sortable columns with a third click:
|
list_rowRendered | function | null | If set, the repeater calls this function after the repeater renders each row, passing a helpers
object and callback function as arguments. This function is the preferred way to modify table row markup.
|
list_highlightSortedColumn | boolean | true | Specifies whether sorted columns should be highlighted. |
Methods
.repeater('list_clearSelectedItems');
Clears any currently selected row items. You can use selectable row items only by enabling the list_selectable
option.
$('#myRepeater').repeater('list_clearSelectedItems');
.repeater('list_getSelectedItems');
Returns the currently selected row items in an array. You can use selectable row items only by enabling the list_selectable
option.
$('#element').repeater('list_getSelectedItems');
.repeater('list_setSelectedItems');
Set the selected row items for the current displayed data. This function accepts an array of items
objects and
force
boolean as arguments.
$('#myRepeater').repeater('list_setSelectedItems', [ {...}, ...]);
Parameter | description |
---|---|
items | Required Array of items objects. The items objects specify which item to select with attributes
to identify the item. If the items object contains an index property, that items object will select the matching item index within the currently displayed data. If the items object contains a property attribute and value attribute, that items object will select items with properties matching the specified value .(ex: [ { index: 4 }, { property: 'name', value: 'nameValue' } ] )
|
force | Optional Boolean specifying whether to ignore current list_selectable mode when
selecting items. This value defaults to false and allows only one selectable item if list_selectable does not equal multi , regardless of how many items
are passed into the items array parameter. Set the value to true to override this behavior
and select all provided items.
|
Events
Event Type | Description |
---|---|
deselected.fu.repeaterList | If list_selectable is enabled, fires whenever the user deselects a row. Provides an event
object and the deselected row as arguments. |
selected.fu.repeaterList | If list_selectable is enabled, fires whenever the user selects a row. Provides an event
object and the selected row as arguments.
|
All repeater-list events are fired on the .repeater
classed element.
$('#myRepeater').on('selected.fu.repeaterList', function () {
// do something…
});