Copied to clipboard

Flag this post as spam?

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


  • mizzle 90 posts 325 karma points
    Sep 21, 2018 @ 14:19
    mizzle
    0

    Finding the parent nodes of Multi-node tree picker selections

    I have to make adjustments to a filter for a bunch of items, which are assigned categories via a multi-node tree picker.

    The filter sorts by selected CATEGORY, and that works fine. I also need it to sort by CATEGORY PARENT, i.e., if the website's category selection looks like this:

    Colors

    • Green
    • Blue
    • Yellow

    and the user selects "Colors," I want it to show any items with either "Green", "Blue", or "Yellow" as an applied category, even if the parent category "Colors" cannot be directly applied to the item.

    The setup currently has items filtering through a query with something like this code (there are several other variables, but this is where the category list is matched with the selected category being queried and items get populated):

    foreach (var item in finalList.Where(x => !String.IsNullOrEmpty(x.GetPropertyValue("categoriesPicker")) && x.GetPropertyValue("categoriesPicker").Split(',').Contains(queriedCatID.ToString())))
    {
    (stuff happens)
    }
    

    So it successfully makes a list of all the categories pulled from the "Categories Picker" Multi-Node Tree Picker, but I can't see anywhere in that code where I could also include the parents of the selected nodes in the split list that the query value would be checked against.

Please Sign in or register to post replies

Write your reply to:

Draft