Skip to content

EspoCRM – Open Source CRM Application

create category fix

Yuriid69db3689f77
diff --git a/client/src/utils.js b/client/src/utils.js
index 2080d78d64..dde58a6b0a 100644
--- a/client/src/utils.js
+++ b/client/src/utils.js
@@ -123,6 +123,7 @@ Espo.Utils = {
else if (typeof view[method] === 'function') {
if (view?.events[`click [data-action="${action}"]`]) {
// Prevents from firing if a handler is already assigned. Important.
+ // Does not prevent if handled from a nested view. @todo
return false;
}
diff --git a/client/src/views/record/list-nested-categories.js b/client/src/views/record/list-nested-categories.js
index 8e422a07bc..517f831f7d 100644
--- a/client/src/views/record/list-nested-categories.js
+++ b/client/src/views/record/list-nested-categories.js
@@ -197,7 +197,7 @@ class ListNestedCategoriesRecordView extends View {
this.listenTo(this.collection, 'sync', () => this.reRender());
this.listenTo(this.itemCollection, 'sync', () => this.reRender());
- this.addActionHandler('createCategory', () => this.actionCreateCategory());
+ this.addActionHandler('createCategory', event => this.handleCreateCategory(event));
}
// noinspection JSUnusedGlobalSymbols
@@ -211,9 +211,12 @@ class ListNestedCategoriesRecordView extends View {
}
/**
+ * @param {MouseEvent} event
* @private
*/
- async actionCreateCategory() {
+ async handleCreateCategory(event) {
+ event.preventDefault();
+
const categoryData = this.collection.categoryData || {};
const view = await new RecordModalHelper().showCreate(this, {