|
@@ -25,23 +25,25 @@ export default class RowSelector {
|
|
|
$document = $(document),
|
|
|
selectAll = options.selectAllSelector;
|
|
|
|
|
|
- $document.on('change', selectAll, function() {
|
|
|
+ $(selectAll).on('change', function() {
|
|
|
$(this).parents(options.container).find(checkboxSelector).prop('checked', this.checked).trigger('change');
|
|
|
});
|
|
|
if (options.clickRow) {
|
|
|
- $document.on('click', checkboxSelector, function (e) {
|
|
|
+ $document.off('click', checkboxSelector).on('click', checkboxSelector, function (e) {
|
|
|
if (typeof e.cancelBubble != "undefined") {
|
|
|
e.cancelBubble = true;
|
|
|
}
|
|
|
if (typeof e.stopPropagation != "undefined") {
|
|
|
e.stopPropagation();
|
|
|
}
|
|
|
- }).parents('tr').click(function (e) {
|
|
|
+ });
|
|
|
+
|
|
|
+ $document.off('click', options.container+' tr').on('click', options.container+' tr', function () {
|
|
|
$(this).find(checkboxSelector).click();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- $document.on('change', checkboxSelector, function () {
|
|
|
+ $document.off('change', checkboxSelector).on('change', checkboxSelector, function () {
|
|
|
var tr = $(this).closest('tr');
|
|
|
if (this.checked) {
|
|
|
tr.css('background-color', options.background);
|