Skip to content

EspoCRM – Open Source CRM Application

Array add items check all option

Yurii771696a4bab3
diff --git a/client/src/views/modals/array-field-add.js b/client/src/views/modals/array-field-add.js
index 0578161893..15ab10a1e1 100644
--- a/client/src/views/modals/array-field-add.js
+++ b/client/src/views/modals/array-field-add.js
@@ -105,6 +105,29 @@ class ArrayFieldAddModalView extends ModalView {
label: 'Cancel',
},
];
+
+ if (this.options.checkAllButton && this.optionList.length) {
+ this.addButton({
+ name: 'checkAll',
+ label: 'Check All',
+ position: 'right',
+ onClick: () => {
+ this.checkedList = [];
+
+ for (const it of this.optionList) {
+ this.checkedList.push(it);
+
+ this.element.querySelectorAll('input[data-value]').forEach(input => {
+ input.checked = true;
+ });
+
+ this.checkedList.length ?
+ this.enableButton('select') :
+ this.disableButton('select');
+ }
+ },
+ });
+ }
}
afterRender() {