[development] how to use an argument to get a row to appear first in a View

Idan Arbel idan at arbel-designs.com
Mon Mar 28 15:36:29 UTC 2011

Thanks for the tip, great idea but it's even trickier...

I'm using a views slideshow to display those nodes together one at a time in
a slideshow, so using two displays/views will be very difficult.

Can I maybe use an argument to modify the node value from the views argument
code? So I'll sort by a field - weight, by default all the nodes will have
this field's value as 0, and I would sort according to the field.
But if there's an argument I would modify field weight to 1 to all nodes
that have that argument.


-----Original Message-----
From: development-bounces at drupal.org [mailto:development-bounces at drupal.org]
On Behalf Of John Fiala
Sent: Monday, March 28, 2011 5:30 PM
To: development at drupal.org
Subject: Re: [development] how to use an argument to get a row to appear
first in a View

On Mon, Mar 28, 2011 at 9:03 AM, Idan Arbel <idan at arbel-designs.com> wrote:
> Hello,
> I have a views slideshow, and in some cases I'd like a certain node to 
> appear first in the order, I don't really care about the rest of the 
> nodes just to move a certain node to be first in the slideshow.
> I'm looking to achieve this using an argument, maybe sending in the 
> nid, or even better a certain value for another field.

Well, if you've got no pager, here's an idea:

You've got two displays - one display (the main one) which displays one
item, and a second display that displays the rest.  Display one is set up to
display only the node provided via the argument, so that's automatically
first.  The second display is made into an attachment on the first display,
which inherits the same argument, only on the second display the argument
defines the node that isn't displayed.

The tricky thing is the way you're displaying them as a grid - that may not
work with having the page split into two views without a lot of work with
css and/or alternate view templates.  It might be simpler to have a 'grand'
display of the argument node on top of a grid showing the rest of them.

John Fiala

More information about the development mailing list