@osimatic/helpers-js 1.1.23 → 1.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/select_all.js +21 -17
package/package.json
CHANGED
package/select_all.js
CHANGED
|
@@ -77,25 +77,29 @@ class SelectAll {
|
|
|
77
77
|
|
|
78
78
|
// Dans un div
|
|
79
79
|
|
|
80
|
-
static initDiv(
|
|
81
|
-
|
|
82
|
-
let
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
allCheckbox.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
static initDiv(contentDiv) {
|
|
81
|
+
contentDiv.find('input.check_all').each(function(idx, inputCheckAll) {
|
|
82
|
+
let div = $(inputCheckAll).closest('div.checkbox_with_check_all');
|
|
83
|
+
|
|
84
|
+
$(inputCheckAll).off('click').click(function() {
|
|
85
|
+
let div = $(this).closest('div.checkbox_with_check_all');
|
|
86
|
+
let allCheckbox = div.find('input[type="checkbox"]:not(.check_all)');
|
|
87
|
+
let allCheckboxChecked = div.find('input[type="checkbox"]:not(.check_all):checked');
|
|
88
|
+
if (allCheckbox.length === allCheckboxChecked.length) {
|
|
89
|
+
allCheckbox.prop('checked', false);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
allCheckbox.prop('checked', true);
|
|
93
|
+
}
|
|
94
|
+
SelectAll.updateDiv(div);
|
|
95
|
+
//SelectAll.updateFormGroup(rootDiv.closest('.form-group'));
|
|
96
|
+
});
|
|
94
97
|
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
div.find('div.checkbox, div.form-check').find('input[type="checkbox"]').change(function() {
|
|
99
|
+
SelectAll.updateDiv($(this).closest('div.checkbox_with_check_all'));
|
|
100
|
+
});
|
|
101
|
+
SelectAll.updateDiv(div);
|
|
97
102
|
});
|
|
98
|
-
SelectAll.updateDiv(div);
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
static updateDiv(div) {
|