diff --git a/index.js b/index.js
index 2eed628f8..a69e25e13 100644
--- a/index.js
+++ b/index.js
@@ -632,7 +632,6 @@ define(function (require) {
dataSource: function (options, callback) {
list(options, callback);
},
- list_selectable: 'multi'
},
'thumbnail': {
dataSource: function (options, callback) {
@@ -750,6 +749,7 @@ define(function (require) {
repeaterActions.repeater({
list_noItemsHTML: 'foo',
list_highlightSortedColumn: true,
+ list_selectable: 'multi',
list_actions: {
width: 37,
items: [
diff --git a/js/repeater-list.js b/js/repeater-list.js
index a1d13fbc4..b62c63303 100755
--- a/js/repeater-list.js
+++ b/js/repeater-list.js
@@ -264,6 +264,8 @@
// Dont show actions dropdown in header if not multi select
if (this.viewOptions.list_selectable === 'multi') {
$actionsColumn.find('thead tr').html('
' + selectlist + ' | ');
+ //disable the header dropdown until an item is selected
+ $actionsColumn.find('thead .btn').attr('disabled', 'disabled');
}
else {
var label = this.viewOptions.list_actions.label || 'a';
@@ -287,32 +289,55 @@
.css('width', this.list_actions_width);
this.$element.find('.repeater-list .actions-column-wrapper th .repeater-list-heading').css('width', this.list_actions_width + 1 + 'px');*/
-
- this.$element.find('.repeater-list table.table-actions tr').each(function (i, elem) {
- $(this).height($table.find('tr:eq(' + i + ')').height());
+ this.$element.find('.repeater-list table.table-actions thead tr th').outerHeight($table.find('thead tr th').outerHeight());
+ this.$element.find('.repeater-list table.table-actions tbody tr td:first-child').each(function (i, elem) {
+ $(this).outerHeight($table.find('tbody tr:eq(' + i + ') td').outerHeight());
});
- this.$element.find('.table-actions .action-item').on('click', function() {
+
+ //row level actions click
+ this.$element.find('.table-actions tbody .action-item').on('click', function() {
var actionName = $(this).data('action');
var row = $(this).data('row');
- self.list_getActionItems(actionName,row);
+ var selected = {
+ actionName: actionName,
+ rows: [row]
+ };
+ self.list_getActionItems(selected);
});
+ // bulk actions click
+ this.$element.find('.table-actions thead .action-item').on('click', function() {
+ var actionName = $(this).data('action');
+ var selected = {
+ actionName: actionName,
+ rows: []
+ };
+ self.$element.find('.repeater-list-wrapper > table .selected').each(function() {
+ var index = $(this).index();
+ index = index + 1;
+ selected.rows.push(index);
+ });
+ self.list_getActionItems(selected);
+ });
};
- $.fn.repeater.Constructor.prototype.list_getActionItems = function (actionName, row) {
-
- var clickedRow = this.$canvas.find('.repeater-list-wrapper > table tbody tr:nth-child('+ row +')');
-
+ $.fn.repeater.Constructor.prototype.list_getActionItems = function (selected) {
+ var i;
+ var selectedObj = [];
var actionObj = $.grep(this.viewOptions.list_actions.items, function(actions){
- return actions.name === actionName;
+ return actions.name === selected.actionName;
})[0];
-
- if (actionObj.clickAction) {
- actionObj.clickAction({
+ for (i = 0; i < selected.rows.length; i++) {
+ var clickedRow = this.$canvas.find('.repeater-list-wrapper > table tbody tr:nth-child('+ selected.rows[i] +')');
+ selectedObj.push({
item: clickedRow,
rowData: clickedRow.data('item_data')
- }, function () {});
+ });
+ }
+
+ if (actionObj.clickAction) {
+ actionObj.clickAction(selectedObj, function () {});
}
};
@@ -322,35 +347,46 @@
$actionsTableHeading.outerHeight($table.find('thead th .repeater-list-heading').outerHeight());
};
- $.fn.repeater.Constructor.prototype.list_multiSelectInitialize = function () {
+ $.fn.repeater.Constructor.prototype.list_frozenOptionsInitialize = function () {
var self = this;
+ var isFrozen = this.viewOptions.list_frozenColumns;
+ var isActions = this.viewOptions.list_actions;
+ var isMulti = this.viewOptions.list_selectable === 'multi';
+
+ var $checkboxes = this.$element.find('.frozen-column-wrapper .checkbox-inline');
+
+ var $everyTable = this.$element.find('.repeater-list table');
+
- var $checkboxes = self.$element.find('.frozen-column-wrapper .checkbox-inline');
//Make sure if row is hovered that it is shown in frozen column as well
this.$element.find('tr.selectable').on('mouseover mouseleave', function(e) {
var index = $(this).index();
index = index + 1;
if (e.type === 'mouseover'){
- self.$element.find('.repeater-list-wrapper > table tbody tr:nth-child('+ index +'), ' +
- '.frozen-column-wrapper tbody tr:nth-child('+ index +')').addClass('hovered');
+ $everyTable.find('tbody tr:nth-child('+ index +')').addClass('hovered');
}
else {
- self.$element.find('.repeater-list-wrapper > table tbody tr:nth-child('+ index +'), ' +
- '.frozen-column-wrapper tbody tr:nth-child('+ index +')').removeClass('hovered');
+ $everyTable.find('tbody tr:nth-child('+ index +')').removeClass('hovered');
}
});
$checkboxes.checkbox();
+ this.$element.find('.table-frozen tbody .checkbox-inline').on('change', function(e) {
+ e.preventDefault();
+ var row = $(this).attr('data-row');
+ row = parseInt(row) + 1;
+ self.$element.find('.repeater-list-wrapper > table tbody tr:nth-child('+ row +')').click();
+ });
+
this.$element.find('.frozen-thead-wrapper thead .checkbox-inline').on('change', function () {
- var $checkboxes = self.$element.find('.frozen-column-wrapper .checkbox-inline');
if ($(this).checkbox('isChecked')){
- $checkboxes.checkbox('check');
+ self.$element.find('.repeater-list-wrapper > table tbody tr:not(.selected)').click();
self.$element.trigger('selected.fu.repeaterList', $checkboxes);
}
else {
- $checkboxes.checkbox('uncheck');
+ self.$element.find('.repeater-list-wrapper > table tbody tr.selected').click();
self.$element.trigger('deselected.fu.repeaterList', $checkboxes);
}
});
@@ -456,10 +492,7 @@
if (this.viewOptions.list_frozenColumns || this.viewOptions.list_actions || this.viewOptions.list_selectable === 'multi') {
this.list_positionColumns();
- }
-
- if (this.viewOptions.list_selectable === 'multi') {
- this.list_multiSelectInitialize();
+ this.list_frozenOptionsInitialize();
}
if (this.viewOptions.list_columnSyncing) {
@@ -498,16 +531,10 @@
$row.append($col);
if (this.viewOptions.list_selectable === 'multi' && columns[columnIndex].property === '@_CHECKBOX_@') {
- var checkBoxMarkup = '