Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paria 3 posts 23 karma points
    22 days ago
    Paria
    0

    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: enter image description here 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.

  • Luuk Peters 84 posts 325 karma points
    2 days ago
  • Paria 3 posts 23 karma points
    1 day ago
    Paria
    0

    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!

Please Sign in or register to post replies

Write your reply to:

Draft