diff --git a/index.js b/index.js
index 2eed628f8..bbf50fa41 100644
--- a/index.js
+++ b/index.js
@@ -632,7 +632,9 @@ define(function (require) {
dataSource: function (options, callback) {
list(options, callback);
},
- list_selectable: 'multi'
+ list_selectable: 'multi',
+ list_columnSizing:false,
+ list_columnSyncing: false
},
'thumbnail': {
dataSource: function (options, callback) {
@@ -750,6 +752,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..41dfd6563 100755
--- a/js/repeater-list.js
+++ b/js/repeater-list.js
@@ -291,28 +291,48 @@
this.$element.find('.repeater-list table.table-actions tr').each(function (i, elem) {
$(this).height($table.find('tr:eq(' + i + ')').height());
});
-
- 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 () {});
}
};
diff --git a/less/repeater-list.less b/less/repeater-list.less
index 51f4bbcb5..6c37c4b29 100755
--- a/less/repeater-list.less
+++ b/less/repeater-list.less
@@ -281,8 +281,11 @@
.repeater-list-heading {
padding: 8px 0 7px;
border-left: 1px solid @gray98;
- margin-left: -1px;
+ margin-left: -9px;
width: 100%;
+ .btn-group {
+ padding-left: 8px;
+ }
}
}
}
@@ -389,6 +392,12 @@
}
}
}
+
+ &.multi-select-enabled.actions-enabled {
+ .repeater-list .actions-column-wrapper table.table-actions tr th .repeater-list-heading {
+ border-left: 1px solid @gray87
+ }
+ }
}
.repeater-loader {
diff --git a/test/repeater-list-test.js b/test/repeater-list-test.js
index cebd2733c..7597f1e26 100644
--- a/test/repeater-list-test.js
+++ b/test/repeater-list-test.js
@@ -67,8 +67,8 @@ define(function(require){
this.$markup = $(html);
this.$markup.find('.repeater-views').append('' +
'');
}
});
@@ -157,7 +157,7 @@ define(function(require){
$repeater.on('loaded.fu.repeater', function(e, options){
count++;
-
+
switch(count){
case 1:
$first = $repeater.find('.repeater-list thead .repeater-list-heading:first');
@@ -198,7 +198,7 @@ define(function(require){
$repeater.on('loaded.fu.repeater', function(){
count++;
-
+
switch(count){
case 1:
$repeater.find('.repeater-list thead th:nth-child(1) .repeater-list-heading').click();
@@ -296,7 +296,7 @@ define(function(require){
$firstRow.click();
$lastRow.click();
-
+
setTimeout(function(){
start();
$repeater.repeater('list_clearSelectedItems');
@@ -321,7 +321,7 @@ define(function(require){
$firstRow.click();
$lastRow.click();
-
+
setTimeout(function(){
start();
selected = $repeater.repeater('list_getSelectedItems');
@@ -345,15 +345,15 @@ define(function(require){
setTimeout(function(){
start();
-
+
$repeater.repeater('list_setSelectedItems', [{ index: 0 }]);
equal($repeater.repeater('list_getSelectedItems').length, 1, 'correct number of items selected');
equal($items.find('tr:first').hasClass('selected'), true, 'correct row selected by index');
-
+
$repeater.repeater('list_setSelectedItems', [{ property: 'commonName', value: 'pig' }]);
equal($repeater.repeater('list_getSelectedItems').length, 1, 'correct number of items selected');
equal($items.find('tr:nth-child(5)').hasClass('selected'), true, 'correct row selected by property/value');
-
+
$repeater.repeater('list_setSelectedItems', [{ index: 0 }, { property: 'commonName', value: 'dog' }], true);
equal($repeater.repeater('list_getSelectedItems').length, 4, 'correct number of items selected when using force');
}, 0);
@@ -413,16 +413,15 @@ define(function(require){
ok($actionsTable.find('tbody tr:first-child .btn-group').hasClass('open'), 'Actions dropdown opens on click');
$actionItem.click();
-
}, 0);
});
function testClickAction(helpers) {
- equal((typeof helpers === 'object' && helpers.item.length > 0), true, 'Items in row were returned after action click');
+ equal((typeof helpers === 'object' && helpers.length > 0), true, 'Items in row were returned after action click');
var count = 0;
- for (var k in helpers.rowData) {
- if (helpers.rowData.hasOwnProperty(k)) {
+ for (var k in helpers[0].rowData) {
+ if (helpers[0].rowData.hasOwnProperty(k)) {
++count;
}
}