From d69db3689f77670f3e0d52b6141ecae194fabade Mon Sep 17 00:00:00 2001 From: Yurii Date: Mon, 2 Feb 2026 19:10:24 +0200 Subject: [PATCH] create category fix --- client/src/utils.js | 1 + client/src/views/record/list-nested-categories.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) 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, {