Cannot get content tree to update after custom sorting
Hello.
I'm trying to add a custom sorting routine for certain nodes when they are added or saved in my content tree. I am using the new API's with ContentService etc.
Here is my sorting method:
int id = headNodeIdToSort();
List<IContent> children = new List<IContent>();
children.AddRange(ApplicationContext.Current.Services.ContentService.GetChildren(id));
children.Sort(new AlphabeticCompare());
for (int i = 0; i < children.Count; i++)
{
children[i].SortOrder = i;
}
umbraco.library.RefreshContent();
Everything works like a charm except that my content tree is not automatically updated, even though i am calling "RefreshContent()". I have to manually perform a "Reload nodes" in the backoffice to see the results of my sort.
Any ideas on how to get this to work without manual interaction?
Thank you Jeroen, the link you posted works for me. I also found a newer way of presenting speechbubbles but that did not give me the content tree refresh i am looking for. So untill i find something better to use i'll stick with this solution.
Edit:
I made a small error in my attempt to use the newer version to present a speechbubble. I tried again and got it to work by using the following code:
using Umbraco.Web.UI.Pages;
using Umbraco.Web.UI;
ClientTools ct = new ClientTools((Page)HttpContext.Current.CurrentHandler);
ct.SyncTree(ApplicationContext.Current.Services.ContentService.GetById(content.ParentId).Path, true).ShowSpeechBubble(Umbraco.Web.UI.SpeechBubbleIcon.Save, "Nytt innehåll", String.Format("{0} har lagts till som {1}", content.Name, content.ContentType.Alias));
So now i can get my content tree updated without using old obsolete methods.
Cannot get content tree to update after custom sorting
Hello.
I'm trying to add a custom sorting routine for certain nodes when they are added or saved in my content tree. I am using the new API's with ContentService etc.
Here is my sorting method:
Everything works like a charm except that my content tree is not automatically updated, even though i am calling "RefreshContent()". I have to manually perform a "Reload nodes" in the backoffice to see the results of my sort.
Any ideas on how to get this to work without manual interaction?
Hello,
There probably is a new way of doing this, but with the old API this worked: http://our.umbraco.org/projects/website-utilities/gecko-uploadify/feedback,-suggestions,-bugs/13119-Reload-tree-after-uploading
Jeroen
Thank you Jeroen, the link you posted works for me. I also found a newer way of presenting speechbubbles but that did not give me the content tree refresh i am looking for. So untill i find something better to use i'll stick with this solution.
Edit:
I made a small error in my attempt to use the newer version to present a speechbubble. I tried again and got it to work by using the following code:
So now i can get my content tree updated without using old obsolete methods.
is working on a reply...