Hi Dave,

Thanks for pointing out the problem. But, how can we work around before you 
guys post the fix?

I tried to just put the dojo code that generated by the tree tag and combined 
with the code in the showcase and the solution posted by Manu Mahajan. My 
test.jsp looks like follows.

Now,  it can fire a node selected event. However, when I tried to show which 
node has been selected by display the nodeId, I got [object Object] displayed. 
I tried nodeId.id and it didn't work either. I am not familar with dojo, would 
you mind to tell me how can I get the id value?

<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<script type="text/javascript">
</script>
</head>
<body> 
<link rel="stylesheet" href="/person/struts/xhtml/styles.css" type="text/css"/>
<script language="JavaScript" type="text/javascript">
// Dojo configuration
djConfig = {
baseRelativePath: "/person/struts/dojo",
isDebug: false,
bindEncoding: "UTF-8",
debugAtAllCosts: true // not needed, but allows the Venkman debugger to work 
with the includes
};
</script>
<script language="JavaScript" type="text/javascript"
src="/person/struts/dojo/dojo.js"></script>
<script language="JavaScript" type="text/javascript"
src="/person/struts/simple/dojoRequire.js"></script>
<script language="JavaScript" type="text/javascript"
src="/person/struts/ajax/dojoRequire.js"></script>
<script language="JavaScript" type="text/javascript"
src="/person/struts/CommonFunctions.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
dojo.require("dojo.lang.*");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Tree");
// dojo.hostenv.writeIncludes();
-->
</script>
<script>
function treeNodeSelected(nodeId) {
alert ('treenode selected: '+ nodeId);
dojo.io.bind({
url: "<s:url value='showtree.action' />?search_order_id="+nodeId,
load: function(type, data, evt) {
var displayDiv = dojo.byId("displayId");
displayDiv.innerHTML = data;
},
mimeType: "text/html"
});
};
dojo.event.topic.subscribe("nodeSelected", this, "treeNodeSelected");
</script>
<dojo:TreeSelector widgetId="treeSelector" 
eventNames="select:nodeSelected"></dojo:TreeSelector> 
<div dojoType="Tree" selector="treeSelector"> 
<div dojoType="TreeNode" title="root" id="0">
<div dojoType="TreeNode" title="node1" id="1">
</div>
<div dojoType="TreeNode" title="node2" id="2">
</div>
</div>
</div>
 
</body>



----- Original Message ----
From: Dave Newton <[EMAIL PROTECTED]>
To: Struts Users Mailing List <user@struts.apache.org>
Sent: Friday, April 13, 2007 4:53:15 PM
Subject: Re: [S2] How to link Tree Node to another dynamic ajax div


--- Minerva CC <[EMAIL PROTECTED]> wrote:
> I followed the instruction for the tree tag and
> created a treeview. Now, I want to select a tree
> node and display some data in another ajax div.

IIRC you need to use Dojo topics to do useful things
with tree events. Alas, I do not think they are
working currently as discussed in a thread a week or
two ago (where I swore my code worked but it had
apparently broken at least a few weeks before and I
hadn't noticed :/

For further details, search the archives for thread (I
don't recall the subject) and look for Manu Mahajan's
messages as he was the driver behind a potential fix.

https://issues.apache.org/struts/browse/WW-1813

d.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to