Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#16166 closed defect (bug) (fixed)

Ajax Table Sorting Session Broken with Bulk Actions

Reported by: hakre's profile hakre Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: General Keywords: has-patch needs-testing dev-feedback
Focuses: Cc:

Description

The 3.1 new ajax table sorting is loosing data in its session when js + bulk requests are used in the session.

I ran over it while analyzing why pagination is lost in #16162 and it came to my attention that sorting is lost as well. While the number of the page is easier to aquire, sorting information can get lost in a session of http requests (as a more formal description of "using the admin").

The loss is a session break between Ajax and non-Ajax requests:

  • If JavaScript is enabled, the table contents is requested via an Ajax request, the location of the page does not change while navigating the table's data.
  • If JavaScript is disabled, the table contents is requested via a standard HTTP "full page" request, the location of the page does change.

The session break now is when bulk actions come into play: Bulk actions are triggering a "full page" request but without leaving any information (or at least without leaving sorting information) to the HTTP request scope as long as those information has been gathered by JavaScript processes.

With JavaScript disabled, the sorting information is not lost.

Bulk actions should always have all navigation related information regardless how the data to create that request has been acquired by the user: Via ajax calls or by simple HTTP "full page" requests.

Related: #14579; #15580

Attachments (5)

garyc40.16166.diff (5.6 KB) - added by garyc40 14 years ago.
don't reset order and orderby when after bulk edit
garyc40.16166.2.diff (6.3 KB) - added by garyc40 14 years ago.
tidy things up a bit
16166.diff (4.9 KB) - added by nacin 14 years ago.
16166.users-first-pass.diff (3.9 KB) - added by nacin 14 years ago.
16166.2.diff (9.4 KB) - added by nacin 14 years ago.
Untested.

Download all attachments as: .zip

Change History (31)

#1 @hakre
14 years ago

I tested the fix in #15416 and it has the same problem. Sorted pagination is broken with bulk actions.

#2 @hakre
14 years ago

Another symptom of this bug: Navigating through pages via Ajax (let's say you go to page 5 in the media library) and then enabling sorting on a column (let's say File) will bring you back to page 1. This symptom is even without a Bulk request. It's just js requests.

Version 0, edited 14 years ago by hakre (next)

#3 @scribu
14 years ago

  • Keywords ux-feedback added
  • Milestone changed from Awaiting Review to 3.1

It sends you back to page 1 on purpose, after performing a search or a sort.

Maybe it doesn't make sense to reset pagination when sorting?

#4 @hakre
14 years ago

Next to that it doesn't make sense, from the serverside, I missed the full pagination data (page-number, sort-column, sort-direction) to create usefull redirect locations server-side. The request only has "paged" from the input.

#5 follow-ups: @jane
14 years ago

I just looked at a couple web sites/apps that have both paging and sorting to see what they do. Typical behavior is to go to page one when a sort is done. The go-to app for behavior checks, gmail, doesn't have paging anymore, since they switched over to river-style (a la twitter).

#6 @scribu
14 years ago

  • Summary changed from Ajax Table Sorting Session Broken with Bulk Actions to Pagination is reset after sorting

#7 @scribu
14 years ago

  • Keywords ux-feedback removed

Thanks Jane.

I guess we then have to find another way to fix the problems caused by this.

#8 in reply to: ↑ 5 ; follow-up: @hakre
14 years ago

Replying to jane:

I just looked at a couple web sites/apps that have both paging and sorting to see what they do. Typical behavior is to go to page one when a sort is done. The go-to app for behavior checks, gmail, doesn't have paging anymore, since they switched over to river-style (a la twitter).

From what I can see in well-made (web)apps is, that if you change the view, the focus stays. Let's say, you're in a list on element 60 (out of 500), numerically sorted ASC, so #60 is POS:60 as well, after sorting the opposite, you're still with focus on #60 while pos is POS:500-60 now. But never is pos POS:1.

Set items per page to 1 and try with wordpress ;)

#9 in reply to: ↑ 8 ; follow-up: @jane
14 years ago

Replying to hakre:

From what I can see in well-made (web)apps is, that if you change the view, the focus stays.

Which ones are you looking at?

#10 @scribu
14 years ago

hakre, I think you're suggesting "local" sorting, i.e. to only sort the items currently in view, right?

I think that's less useful than the global sorting we currently have.

#11 in reply to: ↑ 9 @hakre
14 years ago

Replying to jane:

Replying to hakre:

From what I can see in well-made (web)apps is, that if you change the view, the focus stays.

Which ones are you looking at?

Any application of which has some list - the viewable part of the list is comparable to the viewable page in wordpress. paging is scrolling.

Try Yahoo Mail if you're looking for some table/list that is actually sortable.

I think tine 2.0 has this as well.


Replying to scribu:

hakre, I think you're suggesting "local" sorting, i.e. to only sort the items currently in view, right?

No, infact, it's without the word "only" so probably what you called "global".

But I have no problem to focus on the same item, if that's what you call "local".

Last edited 14 years ago by hakre (previous) (diff)

#12 @hakre
14 years ago

This is one test I did: Compare use with javascript on and off. Compare the different behavior. If you do bulk actions both things are broken. But w/o bulk actions, I have the feeling that w/o javascript works a bit more useful then with javascript.

@garyc40
14 years ago

don't reset order and orderby when after bulk edit

#13 @garyc40
14 years ago

  • Keywords has-patch added

My patch doesn't prevent pagination from resetting when you sort. However, it does prevent order and orderby from resetting when you bulk edit.

#14 @scribu
14 years ago

  • Summary changed from Pagination is reset after sorting to Ajax Table Sorting Session Broken with Bulk Actions

Yeah, we should focus on fixing the bulk action behaviour.

@garyc40
14 years ago

tidy things up a bit

#15 @garyc40
14 years ago

  • Keywords needs-testing dev-feedback added

@nacin
14 years ago

#16 @nacin
14 years ago

(In [17270]) Keep sorting and paging for bulk actions. props garyc40, see #16166.

#17 @nacin
14 years ago

We need to go through the other list tables to see where else that add_query_args code needs to end up.

#18 in reply to: ↑ 5 @voyagerfan5761
14 years ago

  • Cc WordPress@… added

Replying to jane:

The go-to app for behavior checks, gmail, doesn't have paging anymore, since they switched over to river-style (a la twitter).

I can't find any river-style view in Gmail, even with &labs=0. But Gmail doesn't have sorting anyway, nor does it have the ability to switch between ajax and full-page requests within a session. (Users either have full ajax or a basic HTML page.)

#19 @nacin
14 years ago

(In [17273]) #blamenacin, see #16166.

#20 @nacin
14 years ago

(In [17275]) Move wp_redirect calls to the end of the switch in users.php. Fix unrelated bug where the user's cap should be check, rather than their role's cap. see #16166.

#21 @nacin
14 years ago

(In [17276]) Move edit.php bulk actions code to a handler in the list table class. see #16166.

#22 @nacin
14 years ago

(In [17277]) Revert [17275] and [17276]. The rabbit hole is too deep. see #16166.

#23 @nacin
14 years ago

After some additional discussion, the 11 list tables that implement bulk actions have too many differences and idiosyncrasies to implement what we were thinking. (You can see the general idea in [17275].) We'll be adding bandaids at this point.

#24 @scribu
14 years ago

Yeah, I've been down that rabbit hole myself:

http://gsoc.trac.wordpress.org/changeset/757

@nacin
14 years ago

Untested.

#25 @nacin
14 years ago

(In [17321]) Revert [17270], [17273], see #16166, see #16262.

#26 @nacin
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Last edited 14 years ago by nacin (previous) (diff)
Note: See TracTickets for help on using tickets.