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.
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.
3 comments:
When I try to set the order in the data view it always reverts back to the original Data source information.
Any ideas why this would happen?
An alternate way to achieve ordering is to add a custom sort order text column. Then you can use this sort order in various views. As a text column, you can easily insert items between other items by using a series of decimals (1.5 will sort after 1 and before 2. 1.5.3 will sort after 1.5, etc...) the best thing about this approach is that you can edit the list in datasheet view and drag the numbers down as if you were in Excel, and it will intelligently renumber them to clean up these insertions.
hi
thanks for this article is really useful.
do you know if is any want on filter the items to ordered maybe passing a specific view parameter on the url ?
thanks
RF
Post a Comment