Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 05, 2012 @ 15:42
    Fuji Kusaka
    0

    Order not working in Media

    Hi Guys,

    I added a datePicker in my mediaType and somehow cant get OrderBy to work. Has anyone uncounter this issue before ? 

     @foreach(dynamic item in file.Children.Where("NodeTypeAlias == \"Highlights\"").OrderBy("datePicker  desc")){
    }

    Also tried (CreateDate, desc) but still nothing

    //fuji 

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 06, 2012 @ 12:21
    Sebastiaan Janssen
    0

    This seems to work for me in 4.9.0, but remember that all of them should have a date set by the datepicker:

    @{ var file = Library.MediaById(1065); }
    @foreach(dynamic item in file.Children.Where("NodeTypeAlias == \"Image\"").OrderBy("datePicker")){ @item.datePicker<br /> }

    Unfortunately createDate or updateDate do not seem to work, not sure why.

  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 06, 2012 @ 12:32
    Fuji Kusaka
    0

    Hi Sebastiaan,

    Am using v 4.7.2 and yes all items have a Date Picked. But Still not working.  I changed from 

    OrderBy("datePicker desc")
    to
    OrderBy("datePicker")

    but without luck

    Since when creating a new item in nodes the Id Increments i do make use of OrderBy("id desc") which looks well but here unfortunately need to make use of datePicker.

     

     

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 08, 2012 @ 08:34
    Sebastiaan Janssen
    0

    Razor has dramatically improved since 4.7.2. I would recommend upgrading, I just don't think what you're trying to do was actually working at the time.

  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 08, 2012 @ 10:14
    Fuji Kusaka
    0

    Ok will do so Sebastiaan. Will upgrade to v4.9

Please Sign in or register to post replies

Write your reply to:

Draft