diff --git a/js/repeater-list.js b/js/repeater-list.js index 70fa6b28f..811e20393 100755 --- a/js/repeater-list.js +++ b/js/repeater-list.js @@ -594,6 +594,7 @@ if (sortable) { $both.addClass('sortable'); $div.on('click.fu.repeaterList', function () { + if(self.isDisabled) { return; } self.list_sortProperty = (typeof sortable === 'string') ? sortable : columns[index].property; if ($div.hasClass('sorted')) { if ($span.hasClass(chevUp)) { @@ -655,6 +656,7 @@ $row.data('item_data', rows[index]); $row.on('click.fu.repeaterList', function () { + if(self.isDisabled) { return; } var $item = $(this); var index = $(this).index(); index = index + 1; diff --git a/js/repeater.js b/js/repeater.js index 0e5dee843..acbaf3885 100755 --- a/js/repeater.js +++ b/js/repeater.js @@ -60,6 +60,7 @@ this.infiniteScrollingEnabled = false; this.infiniteScrollingEnd = null; this.infiniteScrollingOptions = {}; + this.isDisabled = false; this.lastPageInput = 0; this.options = $.extend({}, $.fn.repeater.defaults, options); this.pageIncrement = 0;// store direction navigated @@ -218,6 +219,7 @@ var disable = 'disable'; var disabled = 'disabled'; + this.isDisabled = true; this.$search.search(disable); this.$filters.selectlist(disable); this.$views.find('label').attr(disabled, disabled); @@ -227,6 +229,14 @@ this.$prevBtn.attr(disabled, disabled); this.$nextBtn.attr(disabled, disabled); + if(this.options.list_actions) { + this.$element.find('.actions-column-wrapper button').attr(disabled, disabled); + } + if(this.options.list_selectable === 'multi') { + this.$element.find('.checkbox-custom').checkbox(disable); + } + + this.$element.addClass('disabled'); this.$element.trigger('disabled.fu.repeater'); }, @@ -236,6 +246,7 @@ var enable = 'enable'; var pageEnd = 'page-end'; + this.isDisabled = false; this.$search.search(enable); this.$filters.selectlist(enable); this.$views.find('label').removeAttr(disabled); diff --git a/less/repeater.less b/less/repeater.less index 624b641ea..65255c79a 100755 --- a/less/repeater.less +++ b/less/repeater.less @@ -108,6 +108,11 @@ line-height: 34px; margin-right: 10px; } + &.disabled { + *:hover { + cursor: not-allowed !important; + } + } /* * reinforce spacing around control buttons diff --git a/test/repeater-list-test.js b/test/repeater-list-test.js index 78e1087fa..17d9d047d 100644 --- a/test/repeater-list-test.js +++ b/test/repeater-list-test.js @@ -155,34 +155,40 @@ define(function(require){ var count = 0; var $first; + $repeater.on('rendered.fu.repeater', function(e, data){ + setTimeout(function(){ + $repeater.repeater('enable'); + var options = data.options; + count++; + switch(count){ + case 1: + $first = $repeater.find('.repeater-list thead .repeater-list-heading:first'); + $first.click(); + break; + case 2: + equal(($first.hasClass('sorted') && $first.find('span').hasClass('glyphicon-chevron-up')), true, 'asc sorted header has appropriate class and icon'); + equal(options.sortDirection, 'asc', 'dataSource passed appropriate sortDirection value'); + equal(options.sortProperty, 'commonName', 'dataSource passed appropriate sortProperty value'); + $first.click(); + break; + case 3: + equal(($first.hasClass('sorted') && $first.find('span').hasClass('glyphicon-chevron-down')), true, 'desc sorted header has appropriate class and icon'); + equal(options.sortDirection, 'desc', 'dataSource passed appropriate sortDirection value'); + equal(options.sortProperty, 'commonName', 'dataSource passed appropriate sortProperty value'); + $first.click(); + break; + case 4: + equal($first.hasClass('sorted'), false, 'previously sorted header reverted to non-sorted'); + equal(options.sortDirection, undefined, 'dataSource passed appropriate sortDirection value'); + equal(options.sortProperty, undefined, 'dataSource passed appropriate sortProperty value'); + $repeater.off('loaded.fu.repeater'); + start(); + break; + } + }, 0); + }); $repeater.on('loaded.fu.repeater', function(e, options){ - count++; - switch(count){ - case 1: - $first = $repeater.find('.repeater-list thead .repeater-list-heading:first'); - $first.click(); - break; - case 2: - equal(($first.hasClass('sorted') && $first.find('span').hasClass('glyphicon-chevron-up')), true, 'asc sorted header has appropriate class and icon'); - equal(options.sortDirection, 'asc', 'dataSource passed appropriate sortDirection value'); - equal(options.sortProperty, 'commonName', 'dataSource passed appropriate sortProperty value'); - $first.click(); - break; - case 3: - equal(($first.hasClass('sorted') && $first.find('span').hasClass('glyphicon-chevron-down')), true, 'desc sorted header has appropriate class and icon'); - equal(options.sortDirection, 'desc', 'dataSource passed appropriate sortDirection value'); - equal(options.sortProperty, 'commonName', 'dataSource passed appropriate sortProperty value'); - $first.click(); - break; - case 4: - equal($first.hasClass('sorted'), false, 'previously sorted header reverted to non-sorted'); - equal(options.sortDirection, undefined, 'dataSource passed appropriate sortDirection value'); - equal(options.sortProperty, undefined, 'dataSource passed appropriate sortProperty value'); - $repeater.off('loaded.fu.repeater'); - start(); - break; - } }); $repeater.repeater({