Browse Source

行选择器优化

jqh 4 years ago
parent
commit
51d47ea8f9

+ 6 - 4
resources/assets/dcat/js/extensions/RowSelector.js

@@ -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);

File diff suppressed because it is too large
+ 0 - 0
resources/dist/dcat/js/dcat-app.js


File diff suppressed because it is too large
+ 0 - 0
resources/dist/dcat/js/dcat-app.js.map


Some files were not shown because too many files changed in this diff