Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
That's too standard at this moment. I am looking for very special things. E.g. for numbers I would like to sort as "5 first, then 2, then 3, then 8, then everything else".
One work around would be to add a sortOrder field to node using CCK
Then it could work in a similar way to weight? Essentially all you'd be doing is assigning a number on importance and then sorting by that number ASC or DESC as needed.
--------------------------
OxAlto Design http://www.oxalto.co.uk
--------------------------
Just wanting to see if anyone has come up with a user-friendly solution.
I am working on a page that will list committee members (i.e. chair, various co-ordinators) and and not sure on the most effective approach to achieving a sort order based on position as opposed to title, date, etc.
The ordering needs to be dynamic given that members will change over time.
I created a nodequeue, ordered the nodes as I wanted them, and added it as a relationship to the view (I also removed any sort ordering from the view) — following the screencast at http://learnbythedrop.com/drop/160
On the nodequeue page the order is exactly how I want it. On the view it is unchanged, producing the same issue I was seeking to overcome.
I am unable to determine why views would sort alphabetically, based on a particular CCK field (even when another field was set as sort criteria), nor why views seems to overwrite the order produced in the nodequeue.
In case someone else stumbles on this post, the answer is yes. There are several options. Please see http://drupal.org/node/398508 to see which best suits your needs.
Comments
So in
So in admin/build/views/edit/yourviewnamehere
Click the + to Sort Criteria, select your field, such as node:title, click add, set the direction and you should be good to go?
(that's from memory at least...)
--------------------------
OxAlto Design
http://www.oxalto.co.uk
--------------------------
--------------------------
OxAlto Design
http://www.oxalto.co.uk
--------------------------
That's too standard at this
That's too standard at this moment. I am looking for very special things. E.g. for numbers I would like to sort as "5 first, then 2, then 3, then 8, then everything else".
One work around would be to
One work around would be to add a sortOrder field to node using CCK
Then it could work in a similar way to weight? Essentially all you'd be doing is assigning a number on importance and then sorting by that number ASC or DESC as needed.
--------------------------
OxAlto Design
http://www.oxalto.co.uk
--------------------------
--------------------------
OxAlto Design
http://www.oxalto.co.uk
--------------------------
I took this approach. It is
I took this approach. It is not very clean, but it is userfriendly as I can allow some users to edit the node weight.
Thanks for your help!
You could also try using the
You could also try using the Nodequeue module to order nodes, then add that as a sort criteria in the view.
Hope that helps!
__________________________________________________________
Mark Theunissen
(work) Digital People
(personal) Code Baboon
If you need it to be more
If you need it to be more automatic, try adding a Computed Field to the CCK type and run some PHP to generate the sort weight.
__________________________________________________________
Mark Theunissen
(work) Digital People
(personal) Code Baboon
What a good idea, I will
What a good idea, I will certainly use this in the future!
Just wanting to see if anyone
Just wanting to see if anyone has come up with a user-friendly solution.
I am working on a page that will list committee members (i.e. chair, various co-ordinators) and and not sure on the most effective approach to achieving a sort order based on position as opposed to title, date, etc.
The ordering needs to be dynamic given that members will change over time.
avolve designs | ethical by design
Then nodequeue is exactly
Then nodequeue is exactly what you want, it is very userfriendly. My users understood it without any help!
Sort by Aggregate field in views 2
My case is a little bit different:
I user view 2 with a patch located at http://drupal.org/files/issues/views-group-aggregate.patch to make views to support group by and aggregation features.
So I can have some thing like
Group by: field A
Aggregate: Sum: Field B
The issue here is how can I sort by the the result of the Aggregate:Sum?
I did try sort by Content: Field B but it's not the result I want.
Thanks
Truyenle
The cleanest way to achieve
The cleanest way to achieve this is with a small custom hook. Check out this post for a good example: http://www.agileapproach.com/blog-entry/using-hookviewsqueryalter-change...
Here is a second example: http://www.nicklewis.org/hook-views-query-alter-how-programatically-alte...
Thank you so much for these 2
Thank you so much for these 2 links: exactly what I was looking for!
I created a nodequeue,
I created a nodequeue, ordered the nodes as I wanted them, and added it as a relationship to the view (I also removed any sort ordering from the view) — following the screencast at http://learnbythedrop.com/drop/160
On the nodequeue page the order is exactly how I want it. On the view it is unchanged, producing the same issue I was seeking to overcome.
I am unable to determine why views would sort alphabetically, based on a particular CCK field (even when another field was set as sort criteria), nor why views seems to overwrite the order produced in the nodequeue.
Anyone have thoughts on this?
avolve designs | ethical by design
In case someone else stumbles
In case someone else stumbles on this post, the answer is yes. There are several options. Please see http://drupal.org/node/398508 to see which best suits your needs.
See
See http://stackoverflow.com/questions/2471361/drupal-sorting-a-view-program...
// reorder with _views_pre_render