Copied to clipboard

Flag this post as spam?

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


  • Garret 68 posts 308 karma points
    Dec 11, 2014 @ 21:52
    Garret
    0

    How to use "filter" argument in ContentService.GetPagedChildren?be

    Hi,

    I would like to know how to use the "filter" argument in 

    Services.ContentService.GetPagedDescendants(id, pageNumber, pageSize, out totalChildren, orderBy, orderDirection, filter);

    because from what i do understand is that I can use it to filter the descendants on properties, is this correct?

    And if so, can anybody explain on how to use it?

    Tnx in advance!
    -
    Garret

  • Rik Hodiamont 56 posts 156 karma points
    Jan 21, 2015 @ 20:31
    Rik Hodiamont
    0

    Hi Garret,

    Did you find a solution for this? I also want to filter on the ContentService!

    Kind regards, Rik

  • Adam Maidment 54 posts 163 karma points
    Mar 02, 2016 @ 22:23
    Adam Maidment
    0

    Hi,

    Due to vitually no real documentation and (afaik) no examples, here's what I've worked out after about 4 hours of internet digging and trial and error:

    long n = 3;
    var descendents = ApplicationContext.Current.Services.ContentService.GetPagedDescendants(node.Id, 1, 3, out n, "UpdateDate", Umbraco.Core.Persistence.DatabaseModelDefinitions.Direction.Descending, "FILTER HERE");
    

    The above is a conversion from a view I had with the following:

    foreach (var child in region.Descendants("location").Where("Visible && popularDestination").OrderBy("UpdateDate desc").Take(3))
    

    With no filter it returns three items, but I really would like to select only nodes of type 'location', but cannot work out the filter parameter.

    If someone from UmbracoHQ (or otherwise) could shed some light or provide a few examples here that would be great.

    Thanks all.

  • Adam Maidment 54 posts 163 karma points
    Mar 31, 2016 @ 20:09
    Adam Maidment
    1

    Hi community,

    I'd really appreciate some help on this. Still stuck on the filter parameter of GetPagedDescendants().

    Is this a filter as used in a typical Where(x == something) statement?

    I'm purely guessing now but not getting anywhere.

    Many thanks

  • Garret 68 posts 308 karma points
    Apr 01, 2016 @ 13:48
    Garret
    0

    same here!

Please Sign in or register to post replies

Write your reply to:

Draft