Copied to clipboard

Flag this post as spam?

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


  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Oct 24, 2015 @ 13:50
    Jan Skovgaard
    0

    Configure MNTP using Xpath - Umbraco 7

    Hi guys

    I'm trying to configure a Multinode Tree Picker to only show certain folders from a content repository, which contains many different folders for different content elements.

    It's been quite a while since I wrote an xpath expression so I might be a bit rusty doing it.

    But I also have a feeling that something might be working dirrently under the hood than it used to do in the versions before 7.

    So I have this site structure

    Sites

    • Site
      • Homepage
        • Page
        • Page etc.
      • Content Repository
        • Folder 1
          • Subfolder 1
            • Element
            • Element
        • Folder 2
          • Subfolder 2
            • Element
            • Element
        • Folder 3
        • Folder 4
        • Folder 5

    Now I only want the content picker to display the contents of folder 1 and 2.

    My xpath looks like this

    $current/ancestor-or-self::Sites/Site//*[self::Folder1Alias | self::Folder2Alias]
    

    In my picker view all I see is the "Subfolder 1" folder...

    How do I need to configure the xpath to have both "Subfolder 1" and "Subfolder 2" available?

    I hope the above illustration of my site structure makes sense :)

    Cheers, Jan

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Oct 24, 2015 @ 14:55
    Chriztian Steinmeier
    2

    Aha!

    Replace the pipe in the predicate with an "or" - the pipe does concatenation which is not what you want in this case ;)

    /Chriztian

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Oct 24, 2015 @ 15:34
    Jan Skovgaard
    0

    Hi Chriztian

    Thank you for the reply - However it does not change much ind the behavior. When I write

    $current/ancestor-or-self::Sites/Site//*[self::Folder1Alias or self::Folder2Alias]
    

    It seems to do the same thing - I only see folders from "Folder1Alias"...and it's actually not listing Folder 1 but the children og Folder 1...I'm a bit confused as to why...can't believe how rusty I have become :-/

    Cheers, Jan

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Oct 24, 2015 @ 15:43
    Chriztian Steinmeier
    2

    ...and now I remember why I usually use nuPickers instead...

    MNTP only lets you choose a parent folder - not the actual doctypes... :-(

    So that's why you're only seeing the children of Folder1Alias - in both cases (| / or) it's either the only or the first node selected, so...

    /Chriztian

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Oct 25, 2015 @ 07:56
    Jan Skovgaard
    1

    Aaah, ok - Well I better see if I can look into them nuPickers on the next project then :)...

    Thanks for helping out Chriztian.

    /Jan

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies