Copied to clipboard

Flag this post as spam?

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


  • Pav 15 posts 45 karma points
    Apr 30, 2014 @ 10:05
    Pav
    0

    Setting up default order for nodes

    Is there any way how I can have automatic sorting for nodes by date

    I know that I can do it manually, but I would prefer to have automatic ordering by date.

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Apr 30, 2014 @ 10:17
    Dennis Aaen
    0

    Hi Pav

    If you are using  Partial Views Macros or Partial Views you can order nodes by doing something like this:

    This example is for Partial Views Macros:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage

    <ul>
        @*OrderBy() takes the property to sort by and optionally order desc/asc *@
       
        @foreach (var page in CurrentPage.Children.Where("Visible").OrderBy("CreateDate desc"))
        {
            <li><a href="@page.Url">@page.Name</a></li>
        }
    </ul>

    But if you´re using Partial Views the basic code is the same only thing that change is the @inherits UmbracoTemplatePage

    If you´re using old DynamicNodeContext razor let me know and I wouldprovide some code for that.

    Hope this helps,

    /Dennis

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Apr 30, 2014 @ 10:24
    Dennis Aaen
    0

    Hi Pav,

    Or did you mean in the nodes in backoffice of Umbraco?

    /Dennis

  • Pav 15 posts 45 karma points
    Apr 30, 2014 @ 13:19
    Pav
    0

    Sorry, I have not forget to post that:

     

    Yest I want it in "back office".

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Apr 30, 2014 @ 13:38
    Dennis Aaen
    0

    Hi Pav,

    If you´re using Umbraco 7 you could try installing the package http://our.umbraco.org/projects/developer-tools/document-sorter, but as you can see from this post maybe is not suppport v7. You can try it as a long shot, as Tom mentions

    http://our.umbraco.org/projects/developer-tools/document-sorter/bugs,-feedback-and-suggestions/49752-U7-Support

    But if you do that, do it on a local test install, or remember to take backup first! Or you could try to get in touch with Jeavon on Twitter. He would know if the package will work for v7. It could also be that he knows some similar packages for Umbraco 7.

    Hope this can help you.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft