Problem/Motivation

When using the option Exposed Grouped on a views filter, there is a limitation of 20 items to sort. This is because the delta of the form is set to 10.

Proposed resolution

Make the #delta value dynamic based on the amount of items of the grouped filter.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

Original report by YoyoS

The delta should be increased when you need to order more than 20 fields, -10 -> 10 isn't enough.

I propose to have a delta of 30 for ordering 60 fields.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

YoyoS created an issue. See original summary.

YoyoS’s picture

swentel’s picture

Status: Active » Needs review

Wondering if we can make it dynamic, say based on the number fields.

dawehner’s picture

Status: Needs review » Needs work

Good idea @swentel ... at that point we should have all fields available ...

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dagmar’s picture

Updating the issue summary to make it clear. Also providing the patch with the dynamic version.

dagmar’s picture

Issue summary: View changes
FileSize
33.6 KB

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.

AndyD328’s picture

Status: Needs review » Reviewed & tested by the community

Many thanks for the patch, it would be great to get this committed.

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.

xjm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

We will need automated test coverage for a bugfix for this.

Also, the existing patch fails, so should not be marked RTBC. Once it is passing and has tests, it should also have test runs queued against SQLite and Postgres.

Thanks!

dagmar’s picture

New patch now with tests.

Lendude’s picture

Status: Needs review » Needs work
FileSize
82.37 KB
56.05 KB

Manually tested this by adding a 4th filter option, and the delta grows with every added group.

Before:

After:

One small thing:

+++ b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/GroupedExposedFilterTest.php
@@ -81,6 +81,25 @@ public function testGroupedFilterValuesUI() {
+    $web_assert->assertWaitOnAjaxRequest();

should use $web_assert->waitForField('options[group_info][group_items][4][title]');. Less random failure prone and clearer about what we are expecting to happen.

dagmar’s picture

Status: Needs work » Needs review
FileSize
2.28 KB
891 bytes

Thanks @Lendude

Lendude’s picture

Status: Needs review » Reviewed & tested by the community

We got a fix and some nice new coverage for a spot that can really use some.

  • lauriii committed 2e02af7 on 8.4.x
    Issue #2667716 by dagmar, YoyoS, Lendude, swentel: Cannot sort a large...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed 2e02af7 and pushed to 8.4.x. Thanks!

lauriii’s picture

Version: 8.4.x-dev » 8.3.x-dev
Status: Fixed » Patch (to be ported)

I see this as a non-disruptive bug fix and therefore this could be considered to be backported to 8.3.x.

xjm’s picture

Status: Patch (to be ported) » Reviewed & tested by the community
Related issues: +#1346760: Add a scalable weight select element, +#1518182: Improve #weight select element behavior based on the number of items

The one question that crossed my mind when I read the final patch was that I had thought we had a render element that handled automatically sizing this, but @lauriii said he checked for that as well and we don't. He also said that this matches other usecases.

The other thought that crossed my mind was scalability if the count was very large (giant select elements crushing the page), but this should be taken care of automatically by the fix from #1346760: Add a scalable weight select element. (#1518182: Improve #weight select element behavior based on the number of items it turns out is still open, but out of scope here.) So we are good on that front as well.

So this patch makes sense and I think is safe/reasonable for backport to the RC. Thanks @lauriii!

  • lauriii committed 94d1a3b on 8.3.x
    Issue #2667716 by dagmar, YoyoS, Lendude, swentel: Cannot sort a large...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Thanks @xjm for confirming. Committed 94d1a3b and pushed to 8.3.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.