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)
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:
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?
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)
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.
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?
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.
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?
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.
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!" ;-)
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
Hi Bo,
You can use the Document Sorter package to automatically sort nodes by built-in or custom fields.
-Tom
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:
Is there anything that I could've missed? :-)
Thanks again! Greatly appreciated.
- Bo
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
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!
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
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)
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
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?
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 ;-)
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!))
If not, I wonder if you can get a more detailed error or a stack trace to help debug, perhaps from the umbracoLog table?
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! :-)
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!" ;-)
Awesome, glad to hear it!
is working on a reply...