Closed (fixed)
Project:
Webform
Version:
8.x-5.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 Feb 2018 at 13:38 UTC
Updated:
1 Mar 2018 at 00:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
idebr 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 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 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 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 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 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 commentedI committed that patch. Please download the latest dev release to review.