Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The current implementation of the webform overview has a declaration for the 'operations' column that makes it incompatible with tablesorting: https://api.drupal.org/api/drupal/core%21includes%21tablesort.inc/8.5.x
Proposed resolution
- Update the 'operation' header to be compatible with tablesorting
- Optional: implement tablesort
Remaining tasks
- Write a patch
- Review
- Commit
User interface changes
None.
API changes
The Webform overview is compatible with tablesort.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#7 | webform-overview_tablesort-2943237-7.patch | 1.9 KB | jrockowitz |
| |||
#7 | webform-overview_tablesort-2943237-7.patch | 1.9 KB | jrockowitz |
| |||
#6 | webform-overview_tablesort-2943237-6.patch | 2.28 KB | idebr |
| |||
#6 | interdiff-4-6.txt | 1.06 KB | idebr |
Comments
Comment #2
idebr CreditAttribution: idebr at ezCompany commentedSolution based on https://drupal.stackexchange.com/questions/192757/how-to-make-entitylist...
The changes in WebformEntityListBuilder::buildHeader() are the only changes required for tablesort compatibility.
Comment #3
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@idebr Your patch makes sense to me but for some reason table sorting is still not working. Maybe someone else can also review/test the patch.
Comment #4
idebr CreditAttribution: idebr at ezCompany commentedRe #3:
In my particular implementation the list builder is extended and includes several custom fields that are sortable. To make a field sortable the header needs an additional array key for 'field' that will be used in the entity query. The default field that should be sorted needs a 'sort' key (asc/desc).
For demonstration purposes I have made the title sortable in this patch. I don't really have an opinion on what fields in the UI should be sortable.
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedAnything that can be sorted should be storable. This is one of those features where someone will get inspired, help implement it, and earn some commit credits.
Comment #6
idebr CreditAttribution: idebr at ezCompany commentedImplemented tablesorting in webform overview for title, description, category, status, owner.
Sorting by total results is a bit of an exception, since 'results_total' is not something that can be automatically sorted by tablesort. There are several options on how this feature can be implemented, so I have filed a follow-up at #2944091: Implement tablesorting in webform overview for 'Total results' so this issue can move forward. Could you take a look at the related issue and see which proposed resolution has your preference?
Comment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@idebr The patch works great. I just made one minor change and I will commit this patch once all the tests pass.
This should be set to 'asc' so that the webforms titles are sorted alphabetically.
Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI committed that patch. Please download the latest dev release to review.