Home > Feature, List, SharePoint > Reordering/Ranking SharePoint List Items

Reordering/Ranking SharePoint List Items

SharePoint link list has a feature which lets you Re-Order list items and this is done using List Actions.

image

This in turn uses ReOrder.aspx page to reorder list items. Here is a summary how this functionality it implemented.

  • Links list contains a field called “Order” which is an internal field and default view is sorted by it.
  • Reorder.aspx uses this Order field to update and reorder list items in that view.
  • Default view is sorted by Order field and reflects the new order.

Now code that runs in Reorder page doesn’t really care about most list types and location since it uses list GUID to modify the order and the Order field is part of each and every list template but for some reason SharePoint has blocked this feature from all the other list templates, like most other things. But given the list GUID Reorder page is able to sort list items. So why doesn’t it work ?  Because Order field being an Internal field is also hidden from other list templates, so while it is possible to reorder we are unable to create a view which will use this order to sort list items.

There are tons of posts around this method and dropping in data view web part to sort list items and solutions which implement their own ordering feature. I prefer a much simpler approach (according to me at least) . Unhide the damn order field and create a view.

I have created a feature which does exactly that.

“List Order”  is feature which enables list re ordering for your custom list. The feature is enabled on “Web” level and enables this action item for all the lists for that particular site. The feature has 2 parts to it:

1. Custom List Action item:  This provides the action item to link to list –reorder page.

image

2. “By Order” View:  When feature is activated, it creates a view on the supported list called “By Order” which is sorted by the “Order” field. (Note: This is only applies to existing lists and wont reflect on  newly created list. however you can create your own views and select the sort by “order” field)

image

Now the feature once activates will provide the Action Item and View to all the supported list types for that particular site. I haven’t tested this feature with huge list or many other scenarios, but I assume it would work similarly to a link list and I don’t see a use case for manually reordering lists with more than 50 items in it.

Screenshots:

1. Reorder Action item on custom list:

image

2. “By Order” view before reordering of list items

image

3. Reorder page

image

4. “Order By” view after refresh

image

Note: It is currently configured to work with following list templates:

  1. Generic List
  2. Contacts List
  3. Task List
  4. Gantt List

You can change them if you like from the source code.

Downloads:

Feature WSP Download
Source code Download
Advertisements
  1. Danny Frye
    August 18, 2010 at 4:51 pm

    How are you suggesting to add this feature. Using the “stsadm -o addsolution” etc method worked for adding the solution, but deploying it failed claiming “operation or method not supported.” I have deployed custom solutions built in VS 2010 to this very Sharepoint instance, so I know it “can” work…

    • bazztrap
      August 18, 2010 at 4:59 pm

      try stsadm.exe” -o deploysolution -name ListOrder.wsp -local -allowgacdeployment

      • Danny Frye
        August 18, 2010 at 6:00 pm

        I still get the following: “The method or operation is not implemented.”

    • bazztrap
      August 18, 2010 at 8:29 pm

      I have updated the solution file. Please download and reinstall it and let me know

      • Danny Frye
        August 18, 2010 at 8:59 pm

        Fixed. Thanks much.

  2. T Can Win
    August 31, 2010 at 9:42 pm

    I have it deployed with no problem. Why is it only available for a custom list and not the “Service Request” list (that comes with the IT Team Workspace template)?

    Thanks

    • spyralout
      August 31, 2010 at 9:45 pm

      This feature does not work with document libraries and since there is no easy way to enable this feature on all lists I have configured it to work with following list templates:
      Generic List
      Contacts List
      Task List
      Gantt List

      but you can download the source the source code and add your list template type and redeploy it.

  3. JP
    September 7, 2010 at 9:34 pm

    Hi,

    Is there any workaround to implement this feature for Doc libs? I can able to attach this feature to the doc template (101) but the order column is not updating.

    Thanks in advance,
    JP

    • spyralout
      September 9, 2010 at 1:59 pm

      You are right it does not work for document libraries.

  4. Ap
    October 6, 2010 at 3:05 pm

    Hi

    I am not a sharepoint expert and would appreciatehave some assistance with this please.

    I have installed the wsp using the following commands:

    “stsadm -o addsolution -filename (path to file)”

    “stsadm -o deploysolution -name ListOrder.wsp -local -allowgacdeployment”

    Both commands completed successfully but the “ReorderList” Action item does not appear on any of my current lists (task lists / Generic lists) and is not available on new lists. I have also tried creating a new view but the “order” field is not available. I guess this is something that i have not done correctly, have i missed something out?

    Thanks in advance

    • spyralout
      October 6, 2010 at 3:31 pm

      Did you activate the feature for the website?

  5. Anthony Paul
    October 8, 2010 at 3:15 pm

    Aha!!

    I hadn’t had to activate a feature before (i told you i was no expert) your assistance was much appreciated.

    Thanks for your all your hard work, this feature will help me no end

  6. Josh
    June 13, 2011 at 5:11 pm

    Do you have any advice on how to convert this to .dwp for 2010?

    Thank you.

  7. Kirk Van Slyke
    October 4, 2011 at 6:06 pm

    Has anyone tried rebuilding this solution with VS2010? I tried, but am having some difficulty with the Sharpoint Packaging tool to get the .wsp built. The source solution as provided, opens as a standard C# solution. However, in order to get the packaging tool, it seems like you have to have a Sharpoint project open. This is where I’m having trouble to build the package.

    any help is appreciated.

  8. Kirk Van Slyke
    October 4, 2011 at 5:50 pm

    Update: I took the approach of simply building the C# project as it exists here. Then used WSPBuilder 2010 beta to build the WSP. Everything built fine. Was able to addsolution to SharePoint server, but when trying to deploysolution, I get the error “The method or operation is not implemented”. No other details on what’s failing. Verified that the feature is not getting deployed to the server.

    any thoughts?

  9. Kirk Van Slyke
    October 7, 2011 at 3:18 pm

    Seems like I’m talking to myself 🙂 but, hey, might was well finish off the thread. The problem was assertions in the feature handlers that weren’t being used. I simply commented ou the unused code, and all is good.

    The only problem now is the limitation of reorder.aspx to paging only 100 items at time. This effectively limit the ranges that you can reorder items in the list. Haven’t seen any solutions posted anywhere on how to get around that.

  10. February 2, 2012 at 4:27 am

    I've got an idea: scprit it so that users of IE6 and below see nothing but a picture of a big old butt.That will show them. Show them a butt, that is.

  11. Alen
    March 16, 2012 at 11:23 am

    I’ve deployed the solution and I now have the action menu “Reorder list items”. However no view called “By Order” is created and I cannot see the Order option when I try to create a new view. I’ve tried this with both generic (custom) lists and task lists. Any clues?

  12. April 27, 2012 at 2:26 am

    I did it slightly differently. http://sangeetahuja.com/re-order-list-items-feature/

    The original solution listed here is more reusable, using a WSP with web level feature.

    I did it differently because I wanted to evade solution deployment (code/impact review of PS is easier for admins ) and also my solution use site collection backup restores between environments. Hence it matches my needs better.

    Thanks for this post and solution

  13. May 25, 2012 at 6:25 am

    Hi Folks,

    Im trying to install the feature but im getting this error:

    Command line error. Invalid parameter

    stsadm.exe -o addsolution
    -filename (Solution Filename)
    [-lcid (language)]

    Any help please????

  14. Mikhail
    June 22, 2012 at 4:28 pm

    Thank you very much for this example.
    It worked for me like a charm

  1. December 17, 2013 at 3:17 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: