From 0aff6228e8dc6ec9dc9931a67507a45a4d3ae388 Mon Sep 17 00:00:00 2001 From: Samuel Raus Date: Tue, 14 Nov 2023 10:53:41 +0100 Subject: [PATCH 1/2] Facilitate external access to the AjaxPaging object --- bundles/LayoutsBundle/Resources/es6/ajax-paging.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bundles/LayoutsBundle/Resources/es6/ajax-paging.js b/bundles/LayoutsBundle/Resources/es6/ajax-paging.js index 4aa6a4a7e..a1d9e962f 100644 --- a/bundles/LayoutsBundle/Resources/es6/ajax-paging.js +++ b/bundles/LayoutsBundle/Resources/es6/ajax-paging.js @@ -31,6 +31,8 @@ class AjaxPaging { this.loadInitial = this.el.hasAttribute('data-load-initial'); this.baseUrl = this.el.dataset.baseUrl; + el.ajaxPaging = this; + this.init(); } @@ -47,10 +49,6 @@ class AjaxPaging { if (this.totalPages > 1) { this.renderNavigation(); - } else { - this.nav.forEach((pager) => { - pager.removeAttribute('data-template'); - }); } this.setupEvents(); @@ -58,7 +56,6 @@ class AjaxPaging { renderNavigation() { this.nav.forEach((pager) => { - pager.removeAttribute('data-template'); pager.innerHTML = templateEngine(this.pagerData.template, { pages: this.totalPages, page: this.page, url: this.generateUrl.bind(this) }); // eslint-disable-line no-param-reassign }); } From a8b0b1c1bf2756e9dc7c6c04d6b207fdc908086e Mon Sep 17 00:00:00 2001 From: Samuel Raus Date: Tue, 14 Nov 2023 14:08:04 +0100 Subject: [PATCH 2/2] Fix issue with eslint --- bundles/LayoutsBundle/Resources/es6/ajax-paging.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/LayoutsBundle/Resources/es6/ajax-paging.js b/bundles/LayoutsBundle/Resources/es6/ajax-paging.js index a1d9e962f..eb56351a1 100644 --- a/bundles/LayoutsBundle/Resources/es6/ajax-paging.js +++ b/bundles/LayoutsBundle/Resources/es6/ajax-paging.js @@ -31,7 +31,7 @@ class AjaxPaging { this.loadInitial = this.el.hasAttribute('data-load-initial'); this.baseUrl = this.el.dataset.baseUrl; - el.ajaxPaging = this; + this.el.ajaxPaging = this; this.init(); }