Copied to clipboard

Flag this post as spam?

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


  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jun 10, 2011 @ 13:49
    Bo Damgaard Mortensen
    0

    Change the way Umbraco sorts nodes

    Hi all,

    Is it possible to change the way Umbraco sorts nodes in the backend? It seems it sorts nodes by ID, but I need to make it sort the nodes in my news section by their createDate instead (because createDate is manipulated sometimes due to some business rules)

    Can this be done? :-)

    Thanks in advance!

    - Bo

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 10, 2011 @ 14:01
    Tom Fulton
    1

    Hi Bo,

    You can use the Document Sorter package to automatically sort nodes by built-in or custom fields.

    -Tom

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jun 10, 2011 @ 14:19
    Bo Damgaard Mortensen
    0

    Hi Tom,

    Thanks a lot! That should definitely do what I'm looking for! However, I can't get it to sort the nodes. I wrote this line in the documentSorter.config:

    <

     

     

    add docTypeAlias="Nyhed" field="createDate" type="Date" order="Asc" />

    Is there anything that I could've missed? :-)

    Thanks again! Greatly appreciated.

    - Bo

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 10, 2011 @ 14:22
    Tom Fulton
    0

    That looks correct.

    One thing is it doesn't refresh the tree automatically (yet) when you sort - you need to right-click and Reload Nodes to see the sort changes.  Did you do that already?

    Also what version of Umbraco are you running, and what level are these documents in the tree?

    -Tom

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jun 10, 2011 @ 14:25
    Bo Damgaard Mortensen
    0

    Hi again Tom and thanks for your reply! :-)

    Yes, I tried to reload the nodes in the news section, but it didn't work either. I'm using Umbraco 4.5.2 and the structure is like this:

    - Content

         - My site

                - News

                      - News item 1

                      - News item 2

                      - .....

    Thanks again!

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jun 10, 2011 @ 14:27
    Bo Damgaard Mortensen
    0

    Wondering if it could have something to do with this issue which I haven't been able to solve yet :-/

    http://our.umbraco.org/forum/developers/api-questions/21015-DateTime-error-on-Document-TypeSort

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 10, 2011 @ 14:28
    Tom Fulton
    0

    Hmm..do you perhaps have an "Remove At" date set on any of the News docs?  I recall some issues in 4.5.2 with sorting when any documents under the parent you are sorting had this set (even with the default Umbraco sorting)

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jun 10, 2011 @ 14:36
    Bo Damgaard Mortensen
    0

    Hi Tom,

    Just had a look through all the news nodes and there wasn't any Remove At or Publish At dates set anywhere :-( I'm quite suspecious about this as the error occurs both on the Sort method and when I try to change the document type.

    - Bo

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 10, 2011 @ 14:42
    Tom Fulton
    0

    I just saw your other thread - sounds like you have some other issues going on :)

    Do you get that error when sorting other nodes or just ones under the News node?  Perhaps you have a "rogue" node stuck in there - do you see more nodes in the Sort dialog than you see in the content tree?

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jun 10, 2011 @ 14:46
    Bo Damgaard Mortensen
    0

    I'm thinking the same, that there's a ghost-node there somewhere (just can't find it! :P ) When I try to Sort (the regular, Umbraco way) on a other set of nodes everything is working as expected, but the pop-up sort window gives me the DateTime casting error shown in my other thread. So I can't see if there's more nodes on the sort list than in the content tree :-/

    I also tried to run an XSLT test to output _all_ news items, but the ghost node doesn't turn up there either.

    Got a bad feeling about this ;-)

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 10, 2011 @ 14:55
    Tom Fulton
    0

    I know you said you deleted some node from the cmsDocument table, did you make sure to delete it from other referenced tables also?

    If you still remember the node ID you might try checking other tables for it.  When I run into the "rogue node" issue this is what I have been doing:

    ((Note, not reccomended, your server may catch fire..make sure to backup your database!))

    DELETE FROM cmsDocument where nodeId=1072
    DELETE FROM cmsPreviewXml WHERE versionId in (SELECT versionId FROM cmsContentVersion WHERE contentid=1072)
    DELETE FROM cmsContentVersion where contentid=1072
    DELETE FROM cmsContentXml where nodeid=1072
    DELETE FROM cmsContent where nodeid=1072
    DELETE FROM cmsPropertyData where contentnodeid=1072
    DELETE FROM umbracoNode where id=1072

    If not, I wonder if you can get a more detailed error or a stack trace to help debug, perhaps from the umbracoLog table?

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jun 10, 2011 @ 15:01
    Bo Damgaard Mortensen
    0

    Tom,

    I gotta admit I don't remember the node id's :-/ *slams his forehead*

    Just had a peek at the umbracoLog table when trying to invoke the Sort method from Umbraco and the error does show up in the log, but the only node id that shows up there is the parent node that I'm trying to sort on.

    Wondering if I could write some SQL to pull out nodeIds from any of the tables you listed if the nodeId doesn't exist in the cmsDocument table. Or something... wish I could get some more detailed information about which node(s) causes the error.

    Thanks again! :-)

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jun 10, 2011 @ 18:18
    Bo Damgaard Mortensen
    0

    Alright, so after a good 3½ hours of hovering the database comparing node id's, I finally found the ghost nodes (there was a few of them!) deleted them and now everything runs just fine!

    Thanks for your help Tom :-)

    All the best,

    Bo

    Note to self: don't ever give away full database access to customers who "knows what they are doing!" ;-)

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 10, 2011 @ 18:19
    Tom Fulton
    0

    Awesome, glad to hear it!

Please Sign in or register to post replies

Write your reply to:

Draft