.Sort(IEnumerable items, [int userId = 0], [bool raiseEvents = true])
Sorts a collection Content objects by updating the SortOrder according to the ordering of items in the passed in System.Collections.Generic.IEnumerable. Returns True if sorting succeeded, otherwise False. Using this method will ensure that the Published-state is maintained upon sorting so the cache is updated accordingly - as needed.
I'm not sure if you remember my question about sorting tags by most used?
In the end this is how I solved it - by keeping the order in umbraco correct, so every time an article is added or updated, I'm searching the index, working out which tags are most used and then changing the order of the nodes in umbraco.
So on the front end I just loop through the nodes in the order that they are stored in umbraco, no need to do any looping logic to work out what is used. - Fast for the end user.
Even in the back office, because I am just searching a custom index to see how many results I have for each tag, this is lighting quick to and is not noticeable.
Really enjoyed cracking that one :-)
Thanks for all your answers, really saved me time.
Via Code - Change the order of Umbraco Nodes in Back office
During the Gathering Node data event, I want to run some code and based on the result I want to change the order of nodes in the Umbraco back office.
Is this possible?
Ayo,
The contentservice api has sort see https://our.umbraco.org/documentation/Reference/Management-v6/Services/ContentService
Thanks Ismail exactly what I was looking for.
I'm not sure if you remember my question about sorting tags by most used?
In the end this is how I solved it - by keeping the order in umbraco correct, so every time an article is added or updated, I'm searching the index, working out which tags are most used and then changing the order of the nodes in umbraco.
So on the front end I just loop through the nodes in the order that they are stored in umbraco, no need to do any looping logic to work out what is used. - Fast for the end user.
Even in the back office, because I am just searching a custom index to see how many results I have for each tag, this is lighting quick to and is not noticeable.
Really enjoyed cracking that one :-)
Thanks for all your answers, really saved me time.
Ayo
is working on a reply...