Wanted to show a pattern in views footer which says: 1 - 5 of 18
For this I added global result summary in views footer and used the following token to show required result: @start - @end of @total
But it's showing some unexpected result and displays "1 - 5 of 4.6116860184274E+18" in the footer.
Its shows correct result only on the last page of the pagination.

Comments

gulab.bisht created an issue. See original summary.

lohndaniel’s picture

Assigned: Unassigned » lohndaniel
Issue tags: +#PenceoWeeklySprint
lohndaniel’s picture

Version: 8.0.6 » 8.2.x-dev
lohndaniel’s picture

StatusFileSize
new1.18 KB

I can reproduce it for mini page only. I've created a patch with a possible solution.
The 'postExecute' function is unnecessary seems to me. Another way please give me more info for it. Thanks!

lohndaniel’s picture

Assigned: lohndaniel » Unassigned
Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 4: 2709147-4.patch, failed testing.

dawehner’s picture

Issue tags: +Needs tests

Just to be clear, the Mini pager is performance optimized, so it doesn't run the pager query by default. This is by design.

lohndaniel’s picture

Assigned: Unassigned » lohndaniel
lohndaniel’s picture

StatusFileSize
new2.94 KB

I've modified patch. It check views footer existing and fill total items variable. Furthermore I've cleaned code for coding standard and readability.

lohndaniel’s picture

Assigned: lohndaniel » Unassigned
Status: Needs work » Needs review

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Algeron’s picture

Similar issue in Views Infinite Scroll: #2791631: Unexpected value for @total token

Algeron’s picture

StatusFileSize
new3.42 KB

The previous patch fixes the bug in the footer, but not in the header. I've updated the patch to resolve this.
This also seems to fix the related issue in Views Infinite Scroll, which inherits from the Mini class.

Tested the following scenarios and they all look fine:
- Infinite Scroll, no total
- Infinite Scroll, total in header
- Infinite Scroll, total in footer
- Mini, no total
- Mini, total in header
- Mini, total in footer

Algeron’s picture

StatusFileSize
new3.52 KB

Accidentally deleted some existing documentation, among other things. Updated patch.

The last submitted patch, 13: 2709147-10.patch, failed testing.

Algeron’s picture

StatusFileSize
new1.91 KB

Hm, I can't get the patch to apply cleanly using composer, for some odd reason.
I removed the code cleanup and stuck to the bugfix. Sorry for the notification spam!

The last submitted patch, 14: 2709147-11.patch, failed testing.

Algeron’s picture

StatusFileSize
new1.95 KB

I swear I'll get it right some day... >_>

The last submitted patch, 16: 2709147-12.patch, failed testing.

dawehner’s picture

It would be quite helpful to just have functional changes in the patch. You know, its a bit hard to also review other changes, like the CS changes at the beginning.

+++ b/core/modules/views/src/Plugin/views/pager/Mini.php
@@ -49,13 +60,22 @@ public function query() {
+
+    // Determine whether we need to calculate the total results.
+    $results = array_merge($this->view->header, $this->view->footer);
+    foreach ($results as $result) {
+      if (strpos($result->options['content'], '@total') !== FALSE) {
+        $this->view->get_total_rows = TRUE;
+      }
+    }

IMHO the right way to implement this would be to let these area handlers tell the view to get all counts using $this->view->get_total_rows = TRUE

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Version: 9.3.x-dev » 8.9.x-dev
Status: Needs review » Closed (cannot reproduce)

@gulab.bisht Thank you for reporting this problem. We rely on issue reports like this to improve Drupal core.

I tested this on 8.9.x and 9.3.x, standard install and devel generated content, and was not able to reproduce this error. I followed the steps given in the Issue Summary.

Therefore, closing as cannot reproduce. If you are experiencing this problem reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").

Thanks!