I need to refresh a container with nodes after some sorting.
How can I refresh the tree from an event handler?
This is my code:
void ContentService_Published(Core.Publishing.IPublishingStrategy sender, Core.Events.PublishEventArgs<IContent> args)
{
if (args.PublishedEntities.Count() == 1)
{
var dirty = (IRememberBeingDirty)args.PublishedEntities.First();
var isNew = dirty.WasPropertyDirty("Id"); // N.B. In 6.2+ use: content.IsNewEntity();
var saveElement = args.PublishedEntities.First();
var itemType = saveElement.ContentType.Alias;
if (itemType != "Event" && itemType != "EventContainer")
{
return;
}
var parentNode = (itemType == "Event"
? args.PublishedEntities.First().ParentId
: args.PublishedEntities.First().Id);
var children = ApplicationContext.Current.Services.ContentService.GetChildren(parentNode).OrderByDescending(page => page.Properties["startDate"].Value);
ApplicationContext.Current.Services.ContentService.Sort(children, 0, false);
//Reload the tree after sorting.
//I NEED TO RELOAD THE TREE
}
}
Refresh tree after sorting nodes
Hi,
I need to refresh a container with nodes after some sorting.
How can I refresh the tree from an event handler?
This is my code:
is working on a reply...