Reordering items in data view

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

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 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: ,,