Reordering items in data view

March 17th, 2008 | Categories: Web design, css | Tags:

A links list in SharePoint has an interesting functionality – to change the order of items.

I’ve tried and this functionality can be applied to all the lists and used in a data view. Let’s go in order.

To reorder the list go to _layouts/reorder.aspx?list={list_guid} in the same site. If you don’t know the list guid, go to list settings and replace listedit.aspx with reorder.aspx. You’ll go to the interface to reorder items in that list:

 
The change will not be visible in SharePoint’s AllItems.aspx page.
 

To sort items in the data view according to ordering you just made:

With data view inserted to the page the first thing we need to do is add the order field to the data view fields. To do this click the list name in the task pane Data Source Details
 

Next click button Fields, find and select Order in the left column and click Add.
 

Click OK to confirm the changes and close the Data Source Properties dialog by clicking OK again. Now you select data view Sorting (in Common Data View Tasks select Sort and Group) and you can choose Order. If you can’t find Order in the dialog box, click the last option (Add Sort Expression) and click Add.
 

In the next dialog box, you can select Order from the fields.
 

Now confirm all the selections by clicking OK to close all dialog boxes.

That’s not all. Now it’s sorted according to order number, but the XSLT is taking this like a text. So we have to fix this. In source code, find <xsl:sort select="@Order" and add a data-type="number" parameter to it.
 

That’s it. Now you have items sorted according to the ordering you’ve made.

What I usually like to add to the data view is a link to reorder items. Just add a footer and in the footer add a hyperlink to the reorder page (the one mentioned at the beginning).

Oznake ponudnika Technorati: ,,
  1. Windy Mitchell
    February 20th, 2010 at 19:07
    Reply | Quote | #1

    Is there a way to show the new postion number?

  2. Windy Mitchell
    February 20th, 2010 at 19:08
    Reply | Quote | #2

    Is there a way to show the new position number? I want to re-rank the list, and I want to show the position numbers as the rank.

    Thanks,

    Windy

  3. Boris Gomiunik
    February 21st, 2010 at 12:40
    Reply | Quote | #3

    Yes, you can. Just drag and drop the “Order” field in your data view or in source code enter

  4. Windy Mitchell
    February 21st, 2010 at 18:55
    Reply | Quote | #4

    I was expecting a postion number from the top; 1, 2, 3, etc. The “order” number that I currently get is something like 250, 500, 600, etc. Any thoughts on how to get the actual position number from the top of the list?

    Thanks,

  5. Boris Gomiunik
    March 4th, 2010 at 14:17
    Reply | Quote | #5

    @Windy: Hi. If you need 1,2,3… numbers, you can use the row’s position: If you have the “Order” column in, in code replace the <xsl:value-of select=”@Order”… with <xsl:value-of select=”position()” />

  6. Bob Sapp
    June 25th, 2010 at 16:49
    Reply | Quote | #6

    Am unable to get this to work cross site, any luck?

  7. Boris Gomiunik
    July 18th, 2010 at 15:53
    Reply | Quote | #7

    I’m not sure what do you mean by cross site?