Copied to clipboard

Flag this post as spam?

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


  • Allan Hawkey 232 posts 303 karma points
    Sep 15, 2011 @ 11:32
    Allan Hawkey
    0

    2.0 beta - posts in wrong order

    I'm populating a blog using 2.0 beta, and have entered 10 posts so far.

    On the landing page, the posts are listed, but my understanding is that these should be in date order (most recent first) - my listings for Sep 2010 show them in the order, by post date:  27 then 30 then 19

    This applies to both the main list of posts and also the latest posts summary in the right column.

    In the tree structure, they seem to be ordered correctly:

    Any ideas how to correct this?

    Thanks
    Allan

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Sep 22, 2011 @ 22:42
    Anthony Dang
    0

    You could add

    nodes = nodes.OrderByDescending(x => x.GetProperty("uBlogsyPostDate").Value.ToString()) 

     

  • Allan Hawkey 232 posts 303 karma points
    Sep 23, 2011 @ 10:13
    Allan Hawkey
    0

    Sorry to ask, but where should this be added to?

  • Allan Hawkey 232 posts 303 karma points
    Sep 26, 2011 @ 18:58
    Allan Hawkey
    0

    Still not got this working - any chance of a pointer please Anthony?  Just need to know where to add that suggested code - wherever I try, I get errors!

    Thanks
    Allan

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Sep 26, 2011 @ 19:17
    Anthony Dang
    0

    Replace this line:

    nodes = ((IEnumerable<DynamicNode>)CommentService.Instance.GetComments(Model.Id, true)).Take(count);

    with these

    nodes = ((IEnumerable<DynamicNode>)CommentService.Instance.GetComments(Model.Id, true));

    nodes = nodes.OrderByDescending(x => x.GetProperty("uBlogsyPostDate").Value.ToString()).Take(count);


     

  • Allan Hawkey 232 posts 303 karma points
    Sep 26, 2011 @ 19:26
    Allan Hawkey
    0

    I don't have that first line in uBlogsyListPosts.cshtml.  Am I looking in the wrong place?

    I do have:

            nodes = ((IEnumerable<DynamicNode>)posts).Take(count);

    and

            nodes = ((IEnumerable<DynamicNode>)posts).Take(count).ToList();
  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Sep 26, 2011 @ 19:29
    Anthony Dang
    0

    Sorry wrong forum post. doh!

    replace 

     

     nodes =((IEnumerable<DynamicNode>)posts).Take(count);

     

    with

     

     nodes =((IEnumerable<DynamicNode>)posts);
    nodes = nodes.OrderByDescending(x => x.CreateDate).
    Take(count);

     

     

     

     

     

  • Allan Hawkey 232 posts 303 karma points
    Sep 26, 2011 @ 19:48
    Allan Hawkey
    0

    That's sorted it - thanks!

  • Allan Hawkey 232 posts 303 karma points
    Sep 27, 2011 @ 13:55
    Allan Hawkey
    0

    Actually, is it possible to sort by POST date rather than by CREATE date?

  • Frost 70 posts 99 karma points
    Oct 25, 2011 @ 01:56
    Frost
    0

    In 3.6.1 I didn't have nodes =((IEnumerable)posts).Take(count); but I was able to make everything sort by date by adding nodes = nodes.OrderByDescending(x => x.CreateDate).Take(count); after both instances of nodes = postList.Take(count); in uBlogsyListPosts.cshtml.

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft