I was thrilled to use Dynamic Root in Umbraco 13 to solve one of my issues about ordering data in a multi-tree picker, but, so disappointed now!
My code is:
public class DynamicArticlesOrderQueryStep : IDynamicRootQueryStep
{
private readonly IContentService _contentService;
public DynamicArticlesOrderQueryStep(IContentService contentService)
{
_contentService = contentService;
}
public async Task<Attempt<ICollection<Guid>>> ExecuteAsync(ICollection<Guid> origins, DynamicRootQueryStep filter)
{
await Task.CompletedTask;
if (filter.Alias != "OrderArticleByDate")
return Attempt<ICollection<Guid>>.Fail();
if (origins.Any() is false)
return Attempt<ICollection<Guid>>.Succeed(Array.Empty<Guid>());
var contentItems = _contentService.GetByIds(origins);
if (contentItems.Any() is false)
return Attempt<ICollection<Guid>>.Fail();
var articles =
_contentService
.GetPagedChildren(contentItems.FirstOrDefault().Id, 0, 10, out long totalRecords, null, Ordering.By("UpdateDate", Direction.Descending));
if (articles.Any())
return Attempt<ICollection<Guid>>.Succeed(articles.Select(x => x.Key).ToList());
return Attempt<ICollection<Guid>>.Succeed(Array.Empty<Guid>());
}
}
my picker setting:
I have no result coming back in the picker, and there is no error in the console or anywhere, when I debug I can see 10 Guids which are correct answers but nothing in back office coming back, did I miss a step? (I did register it by the composer)
I had the same issue and found out, that unfortunately, you can only return parent Ids and the Multinode Picker will then return the children.
E.g. if you had a parent folder called Articles, you need your custom IDynamicRootQueryStep to return the Id of Articles, rather than child article Ids.
Dynamic Root issue
I was thrilled to use Dynamic Root in Umbraco 13 to solve one of my issues about ordering data in a multi-tree picker, but, so disappointed now! My code is:
my picker setting: I have no result coming back in the picker, and there is no error in the console or anywhere, when I debug I can see 10 Guids which are correct answers but nothing in back office coming back, did I miss a step? (I did register it by the composer)
I am using Umbraco version 13.2.2.
Could be related to this?
https://github.com/umbraco/Umbraco-CMS/issues/15770
Don't think so, as it says in the end it worked after refreshing mine never returned any items even when I debug ids were there!
I had the same issue and found out, that unfortunately, you can only return parent Ids and the Multinode Picker will then return the children.
E.g. if you had a parent folder called Articles, you need your custom IDynamicRootQueryStep to return the Id of Articles, rather than child article Ids.
is working on a reply...