Copied to clipboard

Flag this post as spam?

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


  • Phillip Ng 148 posts 250 karma points
    Oct 21, 2011 @ 01:18
    Phillip Ng
    0

    Change sort order in Rollback function

    Hello everyone

    I have a client that is requesting the Rollback function on a content page start with most recent to least recent. Is there an easy way to do this? I couldn't find anything immediately so did some poking around and found a rollback.aspx that uses a rollback.aspx.cs. The code-behind has been compiled however so we can't edit it. Any suggestions? Thanks in advance!

    Phil

  • Rodion Novoselov 694 posts 859 karma points
    Oct 21, 2011 @ 08:29
    Rodion Novoselov
    0

    Hi. The drop down list with all versions is filled from the array that's returned by the Document.GetVersions() method. And this method returns those with the predefined order - from the oldest to the newest ones. So, I think it's not possible to alter this behaviour without modifications to the core. However, I suppose that you could do it at least without rebuilding the whole umbraco - you can place a small piece of javascript code to the /umbraco/dialogs/rollBack.aspx file that will revert the order of the items in the dropdown list on the client as this page is loaded.

  • Rodion Novoselov 694 posts 859 karma points
    Oct 21, 2011 @ 08:47
    Rodion Novoselov
    0

    Below is the sample of possible code:

    <script type="text/javascript">
    //<![CDATA[
        $(function() {
            var opt0 = $('#<%= allVersions.ClientID %> option').first();
            opt0.siblings()
                .remove()
                .each(function() {
                  $(this).insertAfter(opt0);
                });
        });
    //]]>
    </script>
    
  • Phillip Ng 148 posts 250 karma points
    Nov 01, 2011 @ 18:07
    Phillip Ng
    0

    That's awesome -- works like a champ! Thank you very much Rodion!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies