I have a project and one of the requirement is ti be able to re-order images ot items. So lets say they load the page and i have this 6 images.

1  2
3  4
5  6

and the users would like to swap 1 with 6 etc... Just like you do when ordering colums in the list settings. Or is it possible to use a drag and drop component? Would like to read from anyone who has done something similar. Thanks in Advance

3 Answers 3


This open source project does re-ordering using jQuery and the JavaScript Client Object Model - you should be able to adapt it for your needs.


The bulk of the code needed to do this is in WebPart.js -



// If we have an order field to use then work out both what this item's order ID should be
// and update all other items in that column at same time
if (this.OrderField != null) {
    var cards = card.parent().children();
    for (i = 0; i < cards.length; i++) {
        var itemId = $(cards[i]).data("listId");
        if (itemId == mainItemId) {
            mainItemOrder = i + 1;
        else {
            var item = this.List.getItemById(itemId);
            item.set_item(this.OrderField.get_internalName(), i + 1);

The rest of the code is for configuring it for different lists - something you may not need so you could do this as just a javascript file with no web part to deploy.

As Alexander mentioned - you're going to have performance problems with large lists, something to think about.

  • Thanks guys.SPRello look interesting as it looks as it just uses the orderfield.Will this also work eith Document Lib?
    – naijacoder
    Apr 29, 2012 at 5:02
  • Yes - Client Object Model can work with any list type. Just to be clear - this isn't going to 'just do it' for you but will be a good starting point.
    – Ryan
    Apr 30, 2012 at 9:00
  • @Ryan, As u said, i have a problem with large lists. I have a function to do reordering using Javascript and the list contains 2000 items. Its damn slow now and need help on how to improve the performance
    – user9662
    Jul 25, 2012 at 6:54

You could check out the CodePlex project "Drag & Drop for SharePoint, that uses jQuery to achieve this: http://spdragdrop.codeplex.com/

  • as I understand this project is used for moving files between folders in library, but it does not support reordering.
    – Alexander
    Apr 27, 2012 at 8:42

Use javascript on the client side and then sent the http request to the server with the new order. On the server side use SP API to save the new order of the items in the list.

  • if there are many items in the library, the reorder operation can take a lot of time to be performed. Thus it makes sense to create button that sould be send order data to the server. Also you can use client object model for this. But the best choise, I think, will be silverlight.
    – Alexander
    Apr 27, 2012 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.