Opened 8 years ago
Last modified 4 years ago
#38238 reviewing enhancement
Sorting a list table by some kind of count should default to DESC initially
Reported by: | helen | Owned by: | helen |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Administration | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
List tables that can be sorted by some kind of count (posts with that term, comments on that post, etc.) should likely use DESC
for that sort initially, as more frequent user workflows involve wanting to see things with many X (popularity/usage), as opposed to items with no X (cleanup). For example, you may want to see which categories are most popular (related: #36964) or which posts have generated a lot of comments.
Should also consider how sortable custom columns indicate whether to use ASC
or DESC
initially.
Attachments (5)
Change History (16)
#3
@
8 years ago
- Keywords has-patch needs-testing needs-unit-tests added; needs-patch removed
I've attached a patch I made on WCNL2016. This should hopefully fix the issue by switching the ascending and descending on the column sort.
#4
@
8 years ago
Attached a patch also created on WCNL, which holds a different approach.
This patch introduces a new way to communicate with the manage_{$this->screen->id}_sortable_columns
filter, which uses an associative array instead of an indexed array to make each property more clear. Usage:
$sortable['column_name'] = array(
'query_var' => 'query_var_name',
'order' => 'DESC',
);
The patch also switches around the default sorting behaviour (to DESC) for:
WP_Links_List_Table
: ratingWP_Media_List_Table
: comment_countWP_MS_Users_List_Table
: registered dateWP_Posts_List_Table
: comment_count (as proposed in the ticket description)WP_Terms_List_Table
: posts count (as proposed in the ticket description)
#5
@
8 years ago
@harold-angenent 's approach seems to be the appropriate & flexible solution and developers can easily add the 'order' argument when adding their own custom column that has some sort of count quality.
#6
@
8 years ago
@drebbits.web Thanks for your feedback and help! I consciously chose to not make the date in the comments table descending by default, because of the comments of @afercia on #32416. Since comments are already displayed 'last comment first' by default, clicking "date" for the first time should probably change this around.
#8
@
7 years ago
- Keywords needs-unit-tests removed
I added 38238.4.diff, which is based on 38238.2.diff due to the previous comment about the date column in the comments table). This updates the code formatting to more closely follow the project coding guidelines and adds tests to check the default sorting in the various tables.
This ticket was mentioned in Slack in #core by sergey. View the logs.
5 years ago
#10
@
5 years ago
- Keywords needs-refresh added; good-first-bug removed
Thanks @rcutmore for the patch. Unfortunately it no longer applies cleanly so I'll mark this for a refresh.
@helen do you still want to retain ownership of the ticket or shall we free it up for someone else to pick up?
Related: #32170