Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Allow repeater to initialize without a dataSource and no options #1182

Merged
merged 4 commits into from
Mar 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/repeater-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
list_columnSyncing: true,
list_highlightSortedColumn: false,
list_infiniteScroll: false,
list_noItemsHTML: '',
list_noItemsHTML: 'no items found',
list_selectable: false,
list_sortClearing: false,
list_rowRendered: null
Expand Down Expand Up @@ -345,7 +345,7 @@
if ($item.hasClass('selected')) {
$item.removeClass('selected');
$item.find('.repeater-list-check').remove();
$item.$element.trigger('deselected.fu.repeaterList', $item);
self.$element.trigger('deselected.fu.repeaterList', $item);
} else {
if (self.viewOptions.list_selectable !== 'multi') {
self.$canvas.find('.repeater-list-check').remove();
Expand Down
6 changes: 4 additions & 2 deletions js/repeater-thumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
thumbnail_alignment: 'left',
thumbnail_infiniteScroll: false,
thumbnail_itemRendered: null,
thumbnail_noItemsHTML: 'no items found',
thumbnail_selectable: false,
thumbnail_template: '<div class="thumbnail repeater-thumbnail"><img height="75" src="{{src}}" width="65"><span>{{name}}</span></div>'
});
Expand Down Expand Up @@ -139,11 +140,12 @@
alignment = (validAlignments[alignment]) ? alignment : 'justify';
$cont.addClass('align-' + alignment);
this.thumbnail_injectSpacers = true;
response.item = $cont;
} else {
this.thumbnail_injectSpacers = false;
response.action = 'none';
}
response.item = $cont;
} else {
response.action = 'none';
}

if (data.items && data.items.length < 1) {
Expand Down
12 changes: 8 additions & 4 deletions js/repeater.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@
},

itemization: function (data) {
this.$count.html(data.count || '');
this.$end.html(data.end || '');
this.$start.html(data.start || '');
this.$count.html((data.count!==undefined) ? data.count : '?');
this.$end.html((data.end!==undefined) ? data.end : '?');
this.$start.html((data.start!==undefined) ? data.start : '?');
},

next: function (e) {
Expand Down Expand Up @@ -516,6 +516,8 @@
dataOptions = this.getDataOptions(options);

this.viewOptions.dataSource(dataOptions, function (data) {
data = data || {};

if (self.infiniteScrollingEnabled) {
self.infiniteScrollingCallback({});
} else {
Expand Down Expand Up @@ -708,7 +710,9 @@
};

$.fn.repeater.defaults = {
dataSource: function (options, callback) {},
dataSource: function (options, callback) {
callback({ count: 0, end: 0, items: [], page: 0, pages: 1, start: 0 });
},
defaultView: -1, //should be a string value. -1 means it will grab the active view from the view controls
dropPagingCap: 10,
staticHeight: -1, //normally true or false. -1 means it will look for data-staticheight on the element
Expand Down
1 change: 1 addition & 0 deletions less/repeater-list.less
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
&.empty {
td {
border-bottom: none;
font-size: 14px;
font-style: italic;
padding: 20px;
text-align: center;
Expand Down
3 changes: 2 additions & 1 deletion less/repeater-thumbnail.less
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
&.align-right { text-align: right; }

div.empty {
font-size: 14px;
font-style: italic;
padding: 20px 10px;
padding: 14px 10px 20px;
text-align: center;
}

Expand Down