Skip to content

Commit 39ad221

Browse files
update
1 parent 90071b6 commit 39ad221

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/Schema/Pagination/Paginator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function showing(?array $options = [])
205205
}
206206

207207
// only display results when total count is more than 0
208-
echo "<span class='{$settings['span']}' style='display: inline-block; text-align: center; padding: 0;'>
208+
echo "<span data-pagination-showing class='{$settings['span']}' style='display: inline-block; text-align: center; padding: 0;'>
209209
{$formatDisplayText}
210210
</span>
211211
";

src/Schema/Pagination/Yidas/views/cursor.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,19 @@ function closestAnchor(el){
7070
var newContainer = doc.querySelector(targetSelector);
7171
var newScope = doc.querySelector('[data-pagination-scope]');
7272
if(!newContainer || !newScope){ window.location.href = href; return; }
73+
7374
container.innerHTML = newContainer.innerHTML;
75+
76+
// Replace controls to keep next/prev in sync
7477
scope.replaceWith(newScope);
78+
79+
// Update "showing" summary if present on the page
80+
var newShowing = doc.querySelector('[data-pagination-showing]');
81+
var curShowing = document.querySelector('[data-pagination-showing]');
82+
if(newShowing && curShowing){
83+
curShowing.innerHTML = newShowing.innerHTML;
84+
}
85+
7586
try { window.history.pushState({}, '', href); } catch(_e) {}
7687
})
7788
.catch(function(){ window.location.href = href; })

src/Schema/Pagination/Yidas/views/loading.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ function closestAnchor(el){
7878
// Replace controls to keep next/prev in sync
7979
scope.replaceWith(newScope);
8080

81+
// Update "showing" summary if present on the page
82+
var newShowing = doc.querySelector('[data-pagination-showing]');
83+
var curShowing = document.querySelector('[data-pagination-showing]');
84+
if(newShowing && curShowing){
85+
curShowing.innerHTML = newShowing.innerHTML;
86+
}
87+
8188
try { window.history.pushState({}, '', href); } catch(_e) {}
8289
})
8390
.catch(function(){ window.location.href = href; })

0 commit comments

Comments
 (0)