Copied to clipboard

Flag this post as spam?

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


  • Damon 217 posts 287 karma points
    Jul 14, 2015 @ 10:43
    Damon
    0

    Changing order or items added to a macro container

    Hi,

    I am adding multiple content block to page.

    By default when you add a new one, it is added below the previous ones.

    Is it possible to default the position so that the new one added is at the top of this list?

    I want to display them on the page newest first?

    Any ideas how this can be done?

    Thanks,

  • John Churchley 272 posts 1257 karma points c-trib
    Jul 14, 2015 @ 11:05
    John Churchley
    0

    Hi Damon,

    Do you have a screenshot to help with understanding what you mean?

    I believe you looking for something like .OrderBy("CreateDate desc") on the foreach

  • Damon 217 posts 287 karma points
    Jul 14, 2015 @ 12:33
    Damon
    0

    Hi John, thanks for response. Please see screen attached.enter image description here

    The way I am writing this out at the moment is by using @Html.Raw(CurrentPage.contentCards)

    This writes out the HTML and it looks ok. However, how can I access each content card individually. I am not sure whether to use CurrentPage or Model.

    If I could do that I could order them in the way you suggested. At the moment @Html.Raw(CurrentPage.contentCards) return the html, so it is not straightforward to order. By the way the ContentCard in the image is a macro container that contains multiple macros that take some parameters and a template for it. Thanks for any advice!

  • Damon 217 posts 287 karma points
    Jul 14, 2015 @ 12:51
    Damon
    0

    John,

    where is the documentation for these methods? Such as ("CreateDate desc") - how do you know what to use here?

  • John Churchley 272 posts 1257 karma points c-trib
    Jul 14, 2015 @ 13:01
    John Churchley
    0

    If you reorder in the backend does it now translate in to how the html renders? Are you using a custom package for the document type as I'm not familiar with view in your screenshot?

    I'm not sure my initial comment has any relevance sorry. I wasn't sure what you meant.

  • Damon 217 posts 287 karma points
    Jul 14, 2015 @ 13:37
    Damon
    0

    Yea if I reorder the items in the back office it does reorder the html rendered. But I want it to be ordered the opposite way by default.

    I am not using a custom package. For that list I created my own Data Type macro container, which holds by macro I created, which is a macro that takes some parameters and some simple html template. Not sure if this is the best way to do it but it seems neater than not using a macro container.

    Why, is there a package to allow custom ordering?

    Thanks,

  • 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