Jahia DX > tree navigation

0 (0 Good)
0 (0 Bad)

tree navigation

by  obayok »  2012/09/07 09:16

Hi all, i have one quiestion and i would ask help.

I need to create tree navigation like this http://jquery.bassistance.de/treeview/demo/?2  sample2

In my jsp file i have this code:

<script type="text/javascript">
 
    $(document).ready(function() {
         $("#tree${currentNode.identifier}").treeview({
            persist: "location", collapsed: true, unique: true
        });
    });
</script>

<c:set var="pageNode" value="${renderContext.mainResource.node}"/>
<c:set var="nodeTypeForTree" value="${currentNode.properties.nodeType.string}" scope="request"/>
<c:set var="templateForTree" value="${currentNode.properties.templateForLink.string}" scope="request"/>
 
<ul id="tree${currentNode.identifier}">
    <c:forEach var="node" items="${jcr:getChildrenOfType(pageNode,nodeTypeForTree)}">
        <template:module node="${node}" view="hidden.tree" editable="false"/>
    </c:forEach>
</ul>

<c:remove var="nodeTypeForTree" scope="request"/>
<c:remove var="templateForTree" scope="request"/>
 

It is work, but when i click to any item the page is redirect to new page and in the tree i can see just childrens of this page, but i need to see root directory with childen from selected item.

Thanks

 

  • tree navigation
    2012/09/07 09:16

    obayok <p> Hi all, i have one quiestion and i would ask help.</p> <p> I need to create tree navigation like this http://jquery.bassistance.de/treeview/demo/?2&nbsp; sample2</p> <p> In my jsp file i have this code:</p> <p> &lt;script type=&quot;text/javascript&quot;&gt;<br /> &nbsp;<br /> &nbsp;&nbsp;&nbsp; $(document).ready(function() {<br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; $(&quot;#tree${currentNode.identifier}&quot;).treeview({<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;persist: &quot;location&quot;, collapsed: true, unique: true<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br /> &nbsp;&nbsp;&nbsp; });<br /> &lt;/script&gt;<br /> <br /> &lt;c:set var=&quot;pageNode&quot; value=&quot;${renderContext.mainResource.node}&quot;/&gt;<br /> &lt;c:set var=&quot;nodeTypeForTree&quot; value=&quot;${currentNode.properties.nodeType.string}&quot; scope=&quot;request&quot;/&gt;<br /> &lt;c:set var=&quot;templateForTree&quot; value=&quot;${currentNode.properties.templateForLink.string}&quot; scope=&quot;request&quot;/&gt;<br /> &nbsp;<br /> &lt;ul id=&quot;tree${currentNode.identifier}&quot;&gt;<br /> &nbsp;&nbsp;&nbsp; &lt;c:forEach var=&quot;node&quot; items=&quot;${jcr:getChildrenOfType(pageNode,nodeTypeForTree)}&quot;&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;template:module node=&quot;${node}&quot; view=&quot;hidden.tree&quot; editable=&quot;false&quot;/&gt;<br /> &nbsp;&nbsp;&nbsp; &lt;/c:forEach&gt;<br /> &lt;/ul&gt;<br /> <br /> &lt;c:remove var=&quot;nodeTypeForTree&quot; scope=&quot;request&quot;/&gt;<br /> &lt;c:remove var=&quot;templateForTree&quot; scope=&quot;request&quot;/&gt;<br /> &nbsp;</p> <p> It is work, but when i click to any item the page is redirect to new page and in the tree i can see just childrens of this page, but i need to see root directory with childen from selected item.</p> <p> Thanks</p> <p> &nbsp;</p>

  • Number of messages  11
    Registration date Sep 7, 2012
    0 (0 Good)
    0 (0 Bad)

    Re: tree navigation

    by  pap@commaro.com »  2012/09/21 21:51

    Hello,

    the problem is that the pageNode variable you take in the c:forEach is the current page and from there you just retrieve its children.

    You could use ${currentNode.resolveSite.home} as the pageNode to start with the homePage.

    With ${jcr:getMeAndParentsOfType(renderContext.mainResource.node, 'jnt:page')} you get the currently open path.

    Regards,
    Benjamin

    Benjamin Papez (pap@commaro.com)

    Number of messages  220
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: Re: tree navigation

    by  obayok »  2012/10/03 08:34

    Sorry, can you write a sample how it should be?

  • Re: Re: tree navigation
    2012/10/03 08:34

    obayok <p> Sorry, can you write a sample how it should be?</p>

  • Number of messages  11
    Registration date Oct 3, 2012
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page