File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
Need help understanding Dojo Struts2 ajax tree generation
Sheikh Alim
Greenhorn
Joined: Mar 22, 2010
Posts: 2
posted
Mar 22, 2010 05:21:08
0
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
Sheikh Alim
Greenhorn
Joined: Mar 22, 2010
Posts: 2
posted
Mar 23, 2010 03:56:45
0
Any hint
?
I agree. Here's the link:
http://aspose.com/file-tools
subject: Need help understanding Dojo Struts2 ajax tree generation
Similar Threads
pre-populating textfield befor form submit in struts2
For Getting Distinct value (In Struts2)
Showing Distinct Value(In Struts2+Hibernate3+Spring3+jsp project)
Struts2 variable inside javascript
Passing arraylist as hidden variable in JSP Struts2 framework
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter