EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
list show more fix nested case
Yurii3fcf7e99fb38
diff --git a/client/res/templates/record/list-expanded.tpl b/client/res/templates/record/list-expanded.tplindex 9d301a71be..69ad247969 100644--- a/client/res/templates/record/list-expanded.tpl+++ b/client/res/templates/record/list-expanded.tpl@@ -61,13 +61,17 @@{{#if showMoreEnabled}}{{#if showMoreActive}}- <div class="show-more{{#unless showMoreActive}} hidden{{/unless}}">+ <div+ class="show-more {{#unless showMoreActive}} hidden {{/unless}}"+ data-owner-cid="{{viewObject.cid}}"+ ><atype="button"role="button"tabindex="0"class="btn btn-default btn-block"data-action="showMore"+ data-owner-cid="{{viewObject.cid}}"{{#if showCount}}title="{{translate 'Total'}}: {{totalCountFormatted}}"{{/if}}>{{#if showCount}}diff --git a/client/res/templates/record/list-nested-categories.tpl b/client/res/templates/record/list-nested-categories.tplindex fdbdde43bd..a77d7b0761 100644--- a/client/res/templates/record/list-nested-categories.tpl+++ b/client/res/templates/record/list-nested-categories.tpl@@ -106,16 +106,20 @@{{#if showMoreIsActive}}<div class="category-cell">- <div class="category-item show-more">- <span class="category-item-name">- <a- role="button"- tabindex="0"- class="action"- data-action="showMore"- title="{{translate 'Show more'}}"- >...</a>- </span>+ <div+ class="category-item show-more"+ data-owner-cid="{{viewObject.cid}}"+ >+ <span class="category-item-name">+ <a+ role="button"+ tabindex="0"+ class="action"+ data-action="showMore"+ data-owner-cid="{{viewObject.cid}}"+ title="{{translate 'Show more'}}"+ >...</a>+ </span></div></div>{{/if}}diff --git a/client/res/templates/record/list.tpl b/client/res/templates/record/list.tplindex 84c45ae8ab..e92b44a9d8 100644--- a/client/res/templates/record/list.tpl+++ b/client/res/templates/record/list.tpl@@ -228,13 +228,17 @@</table>{{#if showMoreEnabled}}- <div class="show-more{{#unless showMoreActive}} hidden{{/unless}}">+ <div+ class="show-more {{#unless showMoreActive}} hidden {{/unless}}"+ data-owner-cid="{{viewObject.cid}}"+ ><atype="button"role="button"tabindex="0"class="btn btn-default btn-block"data-action="showMore"+ data-owner-cid="{{viewObject.cid}}"{{#if showCount}}title="{{translate 'Total'}}: {{totalCountFormatted}}"{{/if}}>{{#if showCount}}diff --git a/client/src/views/record/list.js b/client/src/views/record/list.jsindex 32ce93e8b6..7137a39f5f 100644--- a/client/src/views/record/list.js+++ b/client/src/views/record/list.js@@ -657,12 +657,6 @@ class ListRecordView extends View {this.actionQuickView({id: id});},- /** @this ListRecordView */- 'click [data-action="showMore"]': async function () {- this.showMoreRecords();-- this.focusOnList();- },'mousedown a.sort': function (e) {e.preventDefault();},@@ -2026,6 +2020,15 @@ class ListRecordView extends View {this.processLinkClick(target.dataset.id);});+ this.addHandler('click', '[data-action="showMore"]', (e, target) => {+ if (target.dataset.ownerCid && target.dataset.ownerCid !== this.cid) {+ return;+ }++ this.showMoreRecords();+ this.focusOnList();+ })+if (typeof this.collection === 'undefined') {throw new Error('Collection has not been injected into views/record/list view.');}@@ -3254,7 +3257,7 @@ class ListRecordView extends View {*/showMoreRecords(options, collection, $list, $showMore, callback) {collection = collection || this.collection;- $showMore = $showMore || this.$el.find('.show-more');+ $showMore = $showMore || this.$el.find(`.show-more[data-owner-cid="${this.cid}"]`);$list = $list || this.$el.find(this.listContainerEl);options = options || {};