Copied to clipboard

Flag this post as spam?

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


  • Marc Aarts 14 posts 35 karma points
    Mar 11, 2011 @ 10:04
    Marc Aarts
    0

    Persistance of sorting (like Document Sorter)

    Great job on this package Sascha.

    After trying it out, I am wondering if you are considering adding a way to persist the sorting after the initial sort.

    Recently I have been working with Matt Brailsford's package 'Document Sorter' and there's obvious similarities between your packages.

    While I love your interface (the popup menu/window) I really like how Matt's tool stores the configuration and applies it to newly added content.

    It would be perfect if both tools were combined and (not held back by knowledge of the inner workings of either tool) I think it should be quite possible to do so.

    Thanks for you efforts.

  • Sascha Wolter 615 posts 1101 karma points
    Mar 16, 2011 @ 01:54
    Sascha Wolter
    0

    Hi Marc,

    thanks for your kind words, much appreciated, and sorry for not replying earlier.

    The basic idea of the package is to allow users to do a manual sort on all child nodes of a selected node based on defined criteria. From a workflow/UX perspective the emphasis here lies on 'manual', ie a user interaction that triggers the sort, which is a one-off occurence.

    Now to make it work like the Document Sorter you'd actually have to hook up the sort trigger to an Umbraco system event (e.g. the publishing of a document) and not to a user interaction on an aspx page via Javascript. That is definitely possible, but changes the nature of the tool quite considerably. There are quite a few more considerations with regards to performance, concurrent editor actions, etc.

    Nonetheless it's definitely a good idea, I envision something like a simple tick-box that will render the current sorting 'permanent', aka all new nodes will be sorted as defined by the criteria. It's quite a bit to implement though, maybe worth a poll to find out how many Umbracians would actually use it that way?

    Anyway, many thanks for putting the two pieces together!

    Cheers,

    Sascha

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Mar 17, 2011 @ 01:02
    Tom Fulton
    0

    Hi Sascha & Mike,

    I've been pondering the same idea.  For a while I've wanted to add a feature in Document Sorter to allow a user/admin to define the "sorting configuration" for a given node via the admin UI.  My initial thoughts were a custom datatype on the Properties tab to define the various sorting attributes, but after seeing this package I really like Sascha's idea of using a context menu action.  I also like your idea of the tick box to make the configuration permanent.

    Have been meaning to ask you (Sascha) about thoughts on possibly combining the two or if its best to keep them separate.  What do you think?

    -Tom

  • Sascha Wolter 615 posts 1101 karma points
    Mar 20, 2011 @ 09:52
    Sascha Wolter
    0

    Hi Tom,

    sorry for not replying earlier. It is certainly a nice and quite reasonble idea, and I guess it would make a lot of sense from a user's perspective: you have the ability to do a manual sort, and when you like what you see can choose with just one more click to have that sorting persist, aka have a new node under that sub node automatically placed at the right position according to the sort order. 

    However from a programmer's perspective the only thing the two modes have in common is the actual sorting (and even that might not be the case as you ideally don't want to sort the whole range of siblings when you just want to insert one node in the list). On the other hand it might not even be necessary to bring both packages together under one hood just to make them work seamlessly in the Umbraco UI. E.g. when you choose to persist the settings in the AutoSort popup a new entry to the DocumentSorter xml config will be written, which will then be automatically picked up by DocumentSorter for all new nodes. What do you think of that?

    From my point of view (or the AutoSorter view) the following needs to happen to persist the sorting:

    - The settings need to be saved somehow in a persisten manner, e.g. a Xml config file or to the database. Ideally there would be a dashboard or something in the backend to manage all your settings in one go. Also there needs to be some good validation, e.g. if you already have a sorting defined on a node that includes all grand-children and then add another manual sorting to a grand-child that should be flagged up and handled, otherwise there will be sorting chaos (other alternative is to exclude grand-child or recursive sorting for the moment). 

    - A custom event handler needs to be implemented that hooks up to all the necessary Umbraco events (on publish, on save, etc). The handler will check if there is a sorting rule which needs to be applied for the current document and if so fires up the sort.

    - There needs to be another sort mechanism which is a bit more efficient for the new task as mentioned above, you don't want to sort the whole sub tree just because one node gets added.

    As I understand it point 3 is fully implemented with DocumentSorter and point 2 pretty much as well. We also need to compare what we can all sort on etc. as I thing AutoSort and DocumentSorter are a bit different in the ranges.

    What do you say?

    Cheers,

    Sascha

  • Stefan Kip 1613 posts 4125 karma points c-trib
    Apr 13, 2011 @ 09:33
    Stefan Kip
    0

    Hmm, I initially thought this is what AutoSorter is all about; automatically sorting nodes when new ones get created...
    So I was surprised to see this is actually a feature request.

    This package is nice, but without the 'automatically keep it sorted' option, it's not really useful for me. So implementing this feature, combined with the current great UI, would be superb!

  • Frost 70 posts 99 karma points
    Nov 14, 2011 @ 22:19
    Frost
    0

    I would use it the same way as kipusoep. Even so, it's quite a nice and tidy package :)

  • Anders Brohäll 295 posts 561 karma points c-trib
    Feb 07, 2012 @ 19:02
    Anders Brohäll
    0

    Any news about this?
    What about triggering it codebehind from the Document.AfterPublish event?

  • Míša Hájková 1 post 22 karma points
    Jun 14, 2012 @ 12:52
    Míša Hájková
    1

    I finished some easy sorting code today. I hope it will be usefull for you.

    This sorting fires after new document is created and automatically sort all siblings alphabetically. You can change direction by simply chaning property in OrderBy() linq part. It's not tested much, but it seems it works well.

    using System;
    using System.Linq;
    using umbraco.cms.businesslogic.web; using umbraco.cms.businesslogic; using umbraco.BusinessLogic; namespace Sorter
    {     class Handlers : umbraco.BusinessLogic.ApplicationBase     {        public Handlers()         { Document.New += new Document.NewEventHandler(Document_New); } void Document_New(Document sender, NewEventArgs e) { Document parent = new Document(sender.ParentId); int i = 0; parent.Children.AsEnumerable().OrderBy(d => d.Text).ToList().ForEach(d=> { d.sortOrder = i++; });
    }
      } }
  • Ridhika 5 posts 25 karma points
    May 18, 2015 @ 10:21
    Ridhika
    0

    The above code will not work on Umbraco 6. Can you please suggest how to automatically sort all siblings when a new node is created in Umbraco 6?

Please Sign in or register to post replies

Write your reply to:

Draft