list show more fix nested case

This commit is contained in:
Yurii
2026-04-06 17:52:38 +03:00
parent c100adc3e5
commit 3fcf7e99fb
4 changed files with 34 additions and 19 deletions

View File

@@ -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}}"
>
<a
type="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}}

View File

@@ -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}}

View File

@@ -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}}"
>
<a
type="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}}

View File

@@ -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 || {};