Closed (works as designed)
Project:
Views (for Drupal 7)
Version:
6.x-2.8
Component:
Views Data
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
22 Dec 2009 at 16:08 UTC
Updated:
10 Jan 2010 at 21:05 UTC
Hi All
I'm hoping someone can help me fix this or point me in the right direction.
I have created a node view that displays all nodes based on a list of nid as arguments.
I am sending in the list as eg. 26+22+25+30+31+32 and the view is returning the nodes but they are not in the same order as the arguments order.
is there a way to do this so they show the node information in the same order.
Regards
Barry
Comments
Comment #1
mtpultz commentedHi Barry did you ever find a solution for the ordering of elements based on argument order?
Thanks
Martin
Comment #2
barrygearing commentedHi Martin
No I didnt get any help on that. But I got it to work another way. I ended up sorting the array in flash where I have control over it.
It is in flash where I am generating the list of arguments to send to flash and then when I get a response I sort them again.
Did you need some help on things?
Regards
Barry
Comment #3
dawehnerI think the problem is currently how sql works.
If there are multiple arguments the following sql is created
WHERE nid IN(1, 4, 3)This returns the nids 1,3,4, but this result is ordered also, by default by primary key asc, or if you have any ORDER BY by this.
I guess the only thing which would be possible would be to sort in after the result of the query.
Comment #4
merlinofchaos commentedFor the reasons dereine mentions, this is not possible. If you really need to do something like this, you could theoretically create a new style plugin based upon the 'unformatted' style that rearranges the rows prior to displaying them. It won't work with paging.
IMO if you need arbitrarily ordered nodes, you're much better off using a module like nodequeue than relying on argument order.
Comment #5
mtpultz commentedNodequeue is perfect! Thanks, it's so easy to use that my client will be able to do their own updates with a pretty small write up by me.
Have you tried changing the default properties of the nodequeue view that is produced? It comes up defaulted as a formatted unordered list of titles and I rather it was defaulted to a formatted grid of content: image attachments. That way I don't have to explain how to change views to the client as this will be the only nodequeue they will be producing.
Thanks either way nodequeue is great. If I have to open permissions to views for them it won't be the end of the world they are more savy then some but I'd still rather remove Views from being editable if possible.
Martin
Comment #6
dawehnerChange the view, disable the views_ui module. Thats all, as far as i understand you.
Comment #7
mtpultz commentedNodequeue generates a view each time you make a new queue with the same properties in it. I'm not sure that if you change one of the nodequeue views and disable the views UI it would stop replicating the default view it creates and start creating nodequeue views with my changes in it.
Thanks though for the help I appreciate it
Comment #8
merlinofchaos commentedEither override the default nodequeue view or disable it entirely and use a different view entirely.
Comment #9
mtpultz commentedI don't seem to have a default view in the Views UI it just shows the nodequeue views that have been created something_1, something_2, etc. I'm not overly good with PHP yet but I'll have a look through the module and try and find out where they set the default properties.
Thanks