Community

RESOLVED: Way to select Field by which to sort a View

Hi,

I have a View that I need to sort based on the Field of the end user's choosing. I tried to do all this by outputting the View as a Table, but after two weeks of hacking, moving various outputted Fields around using CSS, I have only been able to get the whole mess to look good on the Chrome browser -- the hacking is just too much for each browser to deal with , since it relies on the subtle differences in how table HTML is interpreted.

I was told I could output the View in an Unformatted style, then move the Fields around to where I need them. Instead of relying on the Table headers by which to sort, I could expose the fields as Filters. The problem with that is that the exposed Filters expect text input from the user for all the exposed fields, rather than the user choosing one of these exposed fields by which to sort the data. Essentially, I do not need Filters, since filters LIMIT the data shown.

Instead, I need some way to use the Sort Criteria, placing into the View the Fields I want the user to choose from, and have the user choose the one Field by which to sort -- I do not care if the user has to use a list, or radio buttons, or a button array by which to choose the field to sort (think again of the table headers with their up and down arrow, showing which field the table is sorted by)

Is there a module that can be added to Views to make the Unformatted style output sort by the user's chosen criteria?

If not, is someone willing to point me to the way in which something like this might be done? I am frankly more than a bit astonished that nobody has come up with such a module yet, hence my question to the community.

Thanks,
Robert

Comments

_

It's been a while since I used views in d6, but with the 3.x version of views (even in d6), you should be able to expose sorts as well as filters.

_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.

RESOLVED

Thanks for the reply. Actually, I did later find v3 of Views, but according to the developer, in existing implementations of Drupal 6.x, the existing Views nodes will fail to translate when Views is upgraded from v2 to v3.

I did also come across a useful page on how to add the Sort By code to a Views 2 implementation, and upon following the relatively elementary instructions I did get it to work grandly.

This is all great, but stressful, considering I had originally blown over two weeks, attempting repeatedly, and failing, to bend and twist, using css, the Views Tables to layout the page nicely, in the way I wanted it all to look.

At least it is now done, and looks clean and professional.
The web page that did it for me: http://eureka.ykyuen.info/2011/07/28/drupal-add-sorting-to-view/

Thanks,
Rob

nobody click here