Copied to clipboard

Flag this post as spam?

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


  • Chad Rosenthal 272 posts 474 karma points
    Dec 08, 2010 @ 17:27
    Chad Rosenthal
    0

    In the Multi-Node tree Picker, can you deactivate all items that have children?

    Love the picker. I have a tree where I only want the bottom level nodes to be clickable. (i.e. nodes that don't have children of type 'Category'). Can you do this with XPath Filter?

    My current filter is: /*[name()='Category'] 

    Thanks,

    C

  • webangelo 107 posts 190 karma points
    Dec 08, 2010 @ 17:45
    webangelo
    0

    I'm doing this from the top of my head, but did you try

    *[not(*[name()='Category'])]

    I think this is what you are asking.  Or simply

    *[not(*)]

    if you don't care what the node names are below it.

  • Chad Rosenthal 272 posts 474 karma points
    Dec 08, 2010 @ 17:48
    Chad Rosenthal
    0

    Hmm....not quite.

    I tried this: /*[name()='Category' and not(*[name()='Category'])]

    Basically, I want to only display Categories that don't have any children. This didn't seem to change anything from my initial filter.

    -C

     

  • webangelo 107 posts 190 karma points
    Dec 08, 2010 @ 18:17
    webangelo
    0

    Chad,

    I did a test on the following, which picked all Document nodes under the current page which are documents didn't have children which are named Category

    $currentPage/*[@isDoc and not(* [name() = 'Category'])]

    It seemed to work correctly.  You can also use the ancestor axis if you want things above the current page.  I'm not sure if you are already in another loop, so I don't know if the $currentPage is necessary for you.  If you are in another loop using current() may help.

  • Chad Rosenthal 272 posts 474 karma points
    Dec 08, 2010 @ 18:20
    Chad Rosenthal
    0

    That looks correct to me, but I'm trying to put this into an XPath Filter in the multi-node tree picker. Still not working for me.

    -C

  • webangelo 107 posts 190 karma points
    Dec 08, 2010 @ 18:23
    webangelo
    0

    Closer to what you asked is the following:

    $currentPage/*[@isDoc and name() = 'Category' and not(*[@isDoc])]

    This is all Documents which have a name of Category but don't have any children which are documents.  That last is important, as data elements are children of your documents, so if you leave the last [@isDoc] off it will likely return an empty set.

  • Chad Rosenthal 272 posts 474 karma points
    Dec 08, 2010 @ 18:34
    Chad Rosenthal
    0

    Now I'm wondering if we're running into an issue with the node picker.

    /*[@isDoc and name() = 'Category' and (*[@isDoc]) ]  - disabled everything

    /*[@isDoc and name() = 'Category' and not (*[@isDoc]) ] - had all of the categories enabled including ones that had childen.

    I'm wondering if the active/deactive works by parent item. If parent is inactive, all children are inactive. If parent is active, then children can be deactive...depending on the rules.

  • Shannon Deminick 1525 posts 5271 karma points MVP 2x
    Dec 13, 2010 @ 23:14
    Shannon Deminick
    0

    No, active/deactive is based on an individual node basis. The XPath statement is used to match against each node rendered regardless of hierarchy.

    You might be able to use the @level attribute of the node to activate/deactivate children if they are on specific levels

  • Chad Rosenthal 272 posts 474 karma points
    Dec 13, 2010 @ 23:18
    Chad Rosenthal
    0

    Hmm...i'll have to play around some more than. In this case, they are not necessarily at the same level. I'd like Users to be able to add items to the bottom most category.

    Ie:

    - category 1

    ----category 2

    -------category 3

    -------category 4

    ----category 5

    ----category 6

     

    In this case, the only categories that should be selectable are 3, 4, 5 & 6.

    -C

  • Shannon Deminick 1525 posts 5271 karma points MVP 2x
    Dec 13, 2010 @ 23:19
    Shannon Deminick
    0

    The next release (which might be in a month or so... v2.1) will contain the feature to select a start node by XPath and an option to do this from the current node... this might work for you in this circumstance.

  • Shannon Deminick 1525 posts 5271 karma points MVP 2x
    Dec 13, 2010 @ 23:45
    Shannon Deminick
    1

    Sorry, i double posted before reading your last one :(

    Seems that you have a very particular circumstance. Unfortunately i don't see way to make this work. The only way to do so would be to add a feature so that the XPath statement rendered against a node is run against the node in the context of the entire XML tree. The reason why this is not possible now is because MNTP supports unpublished content and since unpublished content does not have an XML placeholder inside of a tree, you can run XPath with axis operators (i.e. ::descendents). In your case you'd want to run an XPath statement something like this to match all nodes that are 'leaf' nodes with no children:

    /*[@isDoc and name()='Category' and count(descendant::*[@isDoc]) = 0]

    But again, the above will not work because at the time of running the XPath statement, it is run against a single node, not in the context of a tree. Changing the XPath statement to run in the context of the entire tree would require yet another option for MNTP to disallow unpublished content, then another option to allow XPath in the context of a tree. Unless you can get some votes up on this and more people would actually want this, then i think it might have to be left to creating a custom data type for this specific purpose.

  • Chad Rosenthal 272 posts 474 karma points
    Dec 13, 2010 @ 23:47
    Chad Rosenthal
    0

    Thanks for the response. I had a feeling that would be the answer, but it's nice to know definitively that it can't be done and why.

    Back to the drawing board :-)

    -C

  • Max Öhman 42 posts 71 karma points
    Dec 14, 2010 @ 13:02
    Max Öhman
    0

    Hi,
    I don't think my problem is as hard as Chads. But I'm trying to find a way of writing my Xpath so it will work with my multilingual site. Is it possible to do this today or do I also have to wait for uC v2.1?

Please Sign in or register to post replies

Write your reply to:

Draft