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

 

  (obayok)

Number of messages  11
Registration date
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?

  (obayok)

Number of messages  11
Registration date
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