Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anders Brännmark 228 posts 280 karma points
    Jul 06, 2010 @ 13:43
    Anders Brännmark
    0

    Sort documents in admin with api?

    Need to automaticlly sort documents in the backend. Anyone done this? I thought of using an actionhandler and use the document.new event. If the document.new is of a certain type, get the parent and loop thru all children and set the sortOrder property and then use the save method? Or do I need to publish also to reflect changes to sortOrder in backend?

     

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 06, 2010 @ 13:54
    Matt Brailsford
    1

    Give my package a try, should do the trick for you:

    http://our.umbraco.org/projects/developer-tools/document-sorter

    Can give you the source code if you are after something different.

    Matt

  • Anders Brännmark 228 posts 280 karma points
    Jul 06, 2010 @ 14:22
    Anders Brännmark
    0

    Hi Matt.

    That package looks great. Can you specify a couple of documenttypes to be sorted? I need to sort at least 4 diffrent types, but dont want the rest of the document types to be sorted...

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 06, 2010 @ 14:44
    Matt Brailsford
    1

    Hi Andres,

    You have a number of options, you can define multiple rules for individual doc types, or you can define an xpath statement for the parent node and everything underneath will be sorted. Or a combination of the 2.

    Let me know if you need any help configuring it for your needs.

    Matt

  • Anders Brännmark 228 posts 280 karma points
    Jul 07, 2010 @ 14:17
    Anders Brännmark
    0

    Installed it, but it seam to sort before publish event? Looks very confusing for the user that way. Can one do it after create?

     

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 07, 2010 @ 14:24
    Matt Brailsford
    0

    Hmm, it currently reorders on save or on publish. I'll try and have a go and see what happens if I get it to sort on create.

    Matt

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 07, 2010 @ 23:47
    Matt Brailsford
    1

    Hey Anders,

    I've done an update, and it looks to work on my version. Give it a try and let me know if you have any problems:

    http://our.umbraco.org/projects/developer-tools/document-sorter

    You'll want to download v1.2.0 which is also umbraco v4.5 compatable.

    Many thanks

    Matt

  • Anders Brännmark 228 posts 280 karma points
    Jul 08, 2010 @ 07:13
    Anders Brännmark
    0

    Matt is it only 4.5 compatable? As I dont want to upgrade to 4.5 yet. Have to many custom controls that access the api's of Umbraco and extensive XSLT files. But many thanks for upgrading to create also!

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 08, 2010 @ 08:17
    Matt Brailsford
    1

    Hey Anders. It should work for both.

    Matt

  • Anders Brännmark 228 posts 280 karma points
    Jul 08, 2010 @ 08:18
    Anders Brännmark
    0

    Nice, will try it out then.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Jul 12, 2010 @ 12:20
    Aaron Powell
    0

    If you only want to have them sorted at a UI-level or you're working with a large node set you can use some code which I showed in a recent presentation: http://www.aaron-powell.com/dddmelbourne-umbraco

    It's then up to your code that's displaying them to re-apply the sorting. It does have the advantage of not being database intensive, but it is v4.5 only.

Please Sign in or register to post replies

Write your reply to:

Draft