Project:Views
Version:5.x-1.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

Expose sorting field and sorting order so that users can sort views tables by table column data, say title, author or date.

Comments

#1

You can already get that kind of thing via table sorting. I suppose it'd be nice to have that kind of functionality outside of tables, but it hasn't been a huge priority because of that.

#2

Thanks! I didn't know. I'll try that.

#3

It's something I'd like to see outside of the table view.

For example, I'm using the Views bonus pack and a three column view. It would be nice to be able to expose the sort for creation date to be able to choose between oldest first and newest first.

#4

While this is not as ideal as exposing the sort, what i usually do is use multiple views, and create them as tabs. The default might be, 'newest first' and the next tab my be 'oldest first'. And may a 'by alpha'.

#5

Ah, good thinking. That'll do just fine.

#6

How can I create them as tabs?

#7

Status:active» fixed

Under the Page section, open up the Menu section. Select provide menu, and provide menu as tab. At least one of the views providing a tab must be set default.

For example, if I have three views under 'foo/bar' I could do this:

URL: foo/bar/newest -- set as tab, set as default tab
URL: foo/bar/alpha -- set as tab
URL: foo/bar/oldest -- set as tab

Marking this fixed -- tabs covers most of the necessary sort options, even though it's possibly a little more difficult than if they were exposed, but the exposed filter code is kind of a pita.

#8

Great! Thanks for explaining and looking into this!

#9

Status:fixed» closed (fixed)

#10

I was interested in making a sortable list of teasers, the approach I took was to create a new type of view which does some special stuff in the theme function. It uses the view's fields for sorting, while displaying the nodes as teasers, not rows in a table. I attach it here in case anyone wants to take it and run with it. Perhaps it could be made worthy of inclusion in views_bonus.

AttachmentSize
sortable_teasers.module 2.07 KB

#11

Hey, totally. You are hereby granted commit access to the bonus pack. Please to be having fun with it! Be sure to update the README and if you have good ideas/are interested in expanding it a bit so it has more inline help for each of the plugins, that'd be welcome.

#12

Status:closed (fixed)» active

I'd really like to have the sort criteria exposed, and perhaps passed in through a query variable. I'm trying to make a view sortable, but it's already using tabs to navigate through categories, so I can't use the 'different views in tabs' idea (also that would mean configuring multiple views, which is a hassle).

#13

Yes, i have the same situation as hickory. Tabs are also not ok if there are lots of fields.

#14

hickory and ultraboy: have you tried sortable_teasers (see #10)???

I'm not sure if you're saying it doesn't work, or whether you have not tried it.

#15

Status:active» needs review

Unless someone else writes it, this is unlikely to be a feature in the 4.7 release. The exposed filters are pretty complex, and exposed sort criteria is likely to add a similar layer of complexity.

That said it's an interesting feature and may well make it into Views 2 but that will be for Drupal 5 only, and I wouldn't expect it for at least a few months.

#16

Status:needs review» postponed

OH a note: sortable_teasers might be good for the bonus pack, if people like it.

#17

Just tracking this issue :-)

#18

Subscribing. Btw, the module seems to work fine in D5 by just creating an .info fie.

#19

I tried using the sortable_teasers in 5.0 and created a .info file - didn't work for me, generated an error.

This would be a much appreciated addition to a views bonus back (exposed sort criteria) - would like viewers on my site to be able to sort by highest rated or recently added - table view doesn't work as its video and I need teasers.

#20

Version:4.7.x-1.x-dev» 5.x-1.x-dev

I'd like to see this for 5.x

I'm trying to set up an ecommerce store and would like to sort the products by price high to low, low to high, brand, and title. I can get close to this using a table view, but I'm not sure if I can theme the single product rows of a table into 3 or 4 products per row.

If I could expose a sort filter for price (high to low and low to high) as well as for brand and title, I could just use a grid view and be done with it. :D

I've also expressed my specific need more thoroughly here http://drupal.org/node/150996

thanks to merlinofchaos and others for the great views module!

#21

Any news or work arounds to get exposed "Sorts"?! I can't believe it's not core :)

#22

same here, it'd be so sweet! any suggestions?

the error i get is;

* warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\includes\tablesort.inc on line 149.
* warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\includes\tablesort.inc on line 187.
* warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\sites\default\modules\views_bonus\sortable_teasers.module on line 35.

#23

Status:postponed» closed (duplicate)

This is never happening for Views 1. It will show up for Views 2 but not until after the 2.0 release.

http://drupal.org/node/228510

#24

i like the tab idea for the sort

#25

You can use hook_views_pre_query() to alter the view and change the sort. Not the same as a nice GUI module though.

#26

Just to add, tabs instead of exposed sorting, does not cover the issue, such as the default Taxonomy/term/tid view that comes with Views 2, which has page path containing % and you can not
set menu for paths with %.

#27

Suscribing.

#28

I tried the Menu Tab suggestion and I don't see the tabs showing up? I think it is a template issue because I programmed my template from scratch and might be missing the required Template Tag (which one do you think it would be). Right now I add links to the different URLS of the different sorting criteria pages but it would be nice if it was more automatic.

#29

Subscribe

#30

I just released a module that works around this problem by exposing the displays of a view as AJAX tabs. Since a display can have a number of settings, one of them being sort order, it allows you to expose sorting and a lot more as well.
http://drupal.org/project/viewsdisplaytabs

#31

Subscribe

#32

Using a table or Views Display Tabs are a few ways to get around this problem, but I think sorting should be possible through exposing the sorting criteria outside of these two options.

Anyone have any progress with this?