• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help understanding Dojo Struts2 ajax tree generation

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to generate a tree using dojo. The version of struts i am using is 2.1.8.

The issue I'm facing is understanding how the child collection property works with dojo tree.

Below is my code for tree generation:

<sx:tree id="tree" childCollectionProperty="children" href="/orgchart/action/default" />

I'm using a jsp to build the supporting JSON string:

<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<c:set var="counter" value="0"></c:set>
[
<s:iterator value="employeeList" var="item">

{
label: "<s:property value='%{#item.empName}' />",
hasChildren:<s:if test='%{#item.isManager == "YES"}'>true,</s:if><s:else>false,</s:else>
id: "<s:property value='%{#item.employeeID}' />"
}
<c:set var="counter" value="${counter + 1 }"></c:set>
<c:if test="${counter < lenght }">,</c:if>

</s:iterator>
]

Now this is rendering the tree as shown in the attached image.

What i fail to understand is how to show one json item as a child of another!

A look at the attached image will reveal that Level -2 should be the root, level -1 its child and accordingly.

But this (as explained in struts2 api) way of building the json does not explain the child collection.

Any help would be greatly appreciated. This is becoming a major roadblock for me.
example.JPG
[Thumbnail for example.JPG]
 
Sheikh Alim
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any hint ?
 
I am displeased. You are no longer allowed to read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic