Copied to clipboard

Flag this post as spam?

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


  • Dovier 3 posts 73 karma points
    Aug 25, 2020 @ 18:45
    Dovier
    0

    Cascading/Dependent MNTPs

    Hello members of the friendliest community on the web!

    I've been learning Umbraco for about 3 months. Currently, I'm something stuck with achieving dependency between two properties in the same document type. I want a MNTP just loading the children of a previously selected node (parent) in another MNTP. I'm currently using Umbraco version 8.6.1. I have followed exactly what is indicated in this article, but I haven't been able to make it work.

    In Content section, you can suppose my structure is:

    DataModel (alias: modelFolders)
        - DataSchool (alias: schoolFolders)
        - - Schools (alias: schoolFolder)
        - - - A (doctype alias: school, node id: 1000)
        - - - - A1 (doctype alias: subSchool)
        - - - - A2 (doctype alias: subSchool)
        - - - B (doctype alias: school, id: node 1001)
        - - - - B1 (doctype alias: subSchool)
        - - - - B2 (doctype alias: subSchool)
    

    In the first MNTP (with alias: pickerSchool) my xpath expression would be something like:

    $root/modelFolders/schoolFolders/schoolFolder
    

    Allow items of type = school

    Which allows me to select A or B.

    According to the aforementioned blogpost, in the second MNTP (with alias: pickerSubSchool) my xpath expression would be something like:

    $root/modelFolders/schoolFolders/schoolFolder/school[@id=./ancestor-or-self::node()[@id=./@id]/pickerSchool/text()]
    

    For example, if A is selected in the first MNTP, then the second MNTP should show me A1 and A2 (to choose between them), but it doesn't happen like that and it shows the entire content tree.

    If I hardcoded the id of one of the nodes, for example:

    $root/modelFolders/schoolFolders/schoolFolder/school[@id=1000]
    

    then, it correctly shows A1 and A2 to select.

    Obviously, the desired solution should be dynamic (not hardcoded).

    Thank you in advance for any help or guidance you can give me on this issue.

    Regards, Dovier

  • Dovier 3 posts 73 karma points
    Aug 28, 2020 @ 18:49
    Dovier
    0

    Hi!

    Please, any possible solutions or ideas for this?

    Thanks in advance.

    Dovier

  • Amir Khan 1199 posts 2567 karma points
    Aug 28, 2020 @ 19:46
  • 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