I have a table of books with this data: name, description, cost, year. I show 15 rows and pagination using AJAX. Each header of each column is clickable and let the user sort the data. The problem comes here: I don't know if I may sort with javascript the 15 rows that are shown or sort the n results of the query on server.

What I have thought is that if I sort just the 15 rows, the user probably will lose some data. But, if I sort the n results, the pagination should start from 1 again, always. Because if I show the same page, the user probably will see other data.

I really don't know, maybe I'm wrong and that's why I'm asking you, what's the best usability way. Thank you very much!

  • 1
    Welcome to UX! Please improve your question by making it more specific - asking what the most usable solution is is very broad and will be hard to answer well.
    – Rahul
    Commented Aug 21, 2011 at 22:00

3 Answers 3


Clicking on a column name must always sort the entire data set imho. There is nothing wrong if the user sees different data on the first page when he knows that he has applied a different sorting criteria.

Sorting only the first page is useful only if you want to execute 2 sorts sequentially. eg: sort the books by cost and further order the top 15 results by their year of release.


The expected behavior is that clicking on a column header sorts the whole dataset, not just the visible part. With straightforward pagination, the results are still perceived as one large dataset, and not as separate subsets.

If you really want users to sort the visible results, you might want to add in a selection / refine results / filter step to explicitly select a smaller set of results to work with. Note that checkboxes in the header for select/deselect all typically work on only the checkboxes below, not on the results that aren't visible.

As for pagination, restarting at page 1 makes sense: for an A-Z sort, items starting with A will show first, which is immediate feedback that the sort went well. In case an application works with one active item, keeping that item in focus and sorting all the other items around it can work too: in that case the results will show the page with the active selection (not necessarily page 1).


If I understand your question correctly - if a user clicks on the table heading to sort and the data has multiple pages, they'd expect the entire data to be sorted rather than just the page they were looking at.

eg. if I wanted to see something with a title starting with Z I'd want to click on the title heading twice (first click should be alphabetically ascending, second click descending) and instantly see my Z items, rather than having to click on the last page and then sort.

Though the question is a little confusing so maybe I have missed your point :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.