You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by GEDA <ge...@gmail.com> on 2007/08/21 12:16:11 UTC

Is there a workaround in order for this to work ?

				<s:tree theme="ajax" rootNode="%{groupTreeModel}"
					childCollectionProperty="children" nodeIdProperty="id"
					nodeTitleProperty="name" treeSelectedTopic="treeSelected">
				</s:tree>

     function treeNodeSelected(nodeId) {
     dojo.byId("id_group").value = nodeId;
     };   
     dojo.event.topic.subscribe("treeSelected", this, "treeNodeSelected");
 </script>

Thank you.
-- 
View this message in context: http://www.nabble.com/%3Cs%3Atree-treeSelectedTopic-property-doesn%27t-fire-any-event-tf4304332.html#a12251999
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Posted by Manu Mahajan <ma...@comprotechnologies.com>.
I put the folder in the root of the application, at the same level as 
WEB-INF

All the best! May the force be with you ;)

GEDA wrote:
> Struts version is 2.0.9
>
> I will try once again and repeat the steps you wrote here. Wish me luck.
> One question: Where exactly did you put the folder template/ajax in your
> application ?
>
> Thanks.
>
>
> Manu Mahajan-2 wrote:
>   
>> This is the link to the file that I used
>> http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl?view=markup&pathrev=528866
>>
>> All I did was
>> 1. added this file to a template/ajax folder in my app
>> 2. modified the function treeNodeSelected in treeExampleStatic.jsp in 
>> the showcase app to the following (the only change is nodeId changed to 
>> message.node.widgetId)
>>
>>  function treeNodeSelected(message) {
>>         dojo.io.bind({
>>             url: "<s:url 
>> value='/tags/ui/ajax/staticTreeSelectAction.action'/>?nodeId="+message.node.widgetId,
>>             load: function(type, data, evt) {
>>                 var divDisplay = dojo.byId("displayIt");
>>                 divDisplay.innerHTML=data;
>>             },
>>             mimeType: "text/html"
>>         });
>>     };
>>
>> 3. restarted tomcat
>>
>> And it worked for me. I just tried this with the 2.0.8 and 2.0.9 
>> showcase apps....
>>
>> What version of struts are you using?
>>
>>
>> GEDA wrote:
>>     
>>> No problem. I took the latest version from svn (it had the description
>>> with
>>> the topic notification fixed) and still doesn't fire any event because I
>>> tested it with an alert function. I also created the path /template/ajax
>>> and
>>> put the tree.ftl file in there. What's wrong with it ?
>>>
>>>   
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>     


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Posted by GEDA <ge...@gmail.com>.
Struts version is 2.0.9

I will try once again and repeat the steps you wrote here. Wish me luck.
One question: Where exactly did you put the folder template/ajax in your
application ?

Thanks.


Manu Mahajan-2 wrote:
> 
> This is the link to the file that I used
> http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl?view=markup&pathrev=528866
> 
> All I did was
> 1. added this file to a template/ajax folder in my app
> 2. modified the function treeNodeSelected in treeExampleStatic.jsp in 
> the showcase app to the following (the only change is nodeId changed to 
> message.node.widgetId)
> 
>  function treeNodeSelected(message) {
>         dojo.io.bind({
>             url: "<s:url 
> value='/tags/ui/ajax/staticTreeSelectAction.action'/>?nodeId="+message.node.widgetId,
>             load: function(type, data, evt) {
>                 var divDisplay = dojo.byId("displayIt");
>                 divDisplay.innerHTML=data;
>             },
>             mimeType: "text/html"
>         });
>     };
> 
> 3. restarted tomcat
> 
> And it worked for me. I just tried this with the 2.0.8 and 2.0.9 
> showcase apps....
> 
> What version of struts are you using?
> 
> 
> GEDA wrote:
>> No problem. I took the latest version from svn (it had the description
>> with
>> the topic notification fixed) and still doesn't fire any event because I
>> tested it with an alert function. I also created the path /template/ajax
>> and
>> put the tree.ftl file in there. What's wrong with it ?
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%3Cs%3Atree-treeSelectedTopic-property-doesn%27t-fire-any-event-tf4304332.html#a12275350
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Posted by Manu Mahajan <ma...@comprotechnologies.com>.
This is the link to the file that I used
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl?view=markup&pathrev=528866

All I did was
1. added this file to a template/ajax folder in my app
2. modified the function treeNodeSelected in treeExampleStatic.jsp in 
the showcase app to the following (the only change is nodeId changed to 
message.node.widgetId)

 function treeNodeSelected(message) {
        dojo.io.bind({
            url: "<s:url 
value='/tags/ui/ajax/staticTreeSelectAction.action'/>?nodeId="+message.node.widgetId,
            load: function(type, data, evt) {
                var divDisplay = dojo.byId("displayIt");
                divDisplay.innerHTML=data;
            },
            mimeType: "text/html"
        });
    };

3. restarted tomcat

And it worked for me. I just tried this with the 2.0.8 and 2.0.9 
showcase apps....

What version of struts are you using?


GEDA wrote:
> No problem. I took the latest version from svn (it had the description with
> the topic notification fixed) and still doesn't fire any event because I
> tested it with an alert function. I also created the path /template/ajax and
> put the tree.ftl file in there. What's wrong with it ?
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Posted by GEDA <ge...@gmail.com>.
No problem. I took the latest version from svn (it had the description with
the topic notification fixed) and still doesn't fire any event because I
tested it with an alert function. I also created the path /template/ajax and
put the tree.ftl file in there. What's wrong with it ?


Manu Mahajan-2 wrote:
> 
> Sorry about the link that came in because I copy pasted text from the 
> web page and thunderbird copied the hyperlink as well. Please ignore the 
> link. I assume you have got the correct tree.ftl file.
> 
> Please note that the parameter passed to the javascript callback 
> function will not be the "nodeId" but it will be a dojo "message" object.
> 
> try replacing the following code
> 
> function treeNodeSelected(nodeId)
> {
> dojo.byId("id_group").value = nodeId;
> }
> 
> with
> 
> function treeNodeSelected(message)
> { 
>      dojo.byId("id_group").value = message.node.widgetId;
> }
> 
> GEDA wrote:
>> I did download the tree.ftl file from the file attachement but still
>> doesn't
>> work. The link you gave me is not an actual file but a diff file which I
>> don't know how to use it. :(
>>
>>
>> Manu Mahajan-2 wrote:
>>   
>>> Hi
>>>
>>> Try this. Create a directory template/ajax in your application and copy 
>>> the file tree.ftl from this page
>>> https://issues.apache.org/struts/browse/WW-1813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>>> You can search for this string  
>>> "/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl 
>>> <http://svn.apache.org/viewcvs.cgi//struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl/?rev=528866&view=diff&r1=528866&r2=528865&p1=/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl&p2=/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl>" 
>>>
>>> (You'll find a link to the file modified on 14th Apr)
>>>
>>> Your code should work now. I just tested this with a standard 2.0.8 
>>> showcase app.
>>>
>>> Manu
>>>
>>> GEDA wrote:
>>>     
>>>> Is there a workaround in order for this to work ?
>>>>
>>>> 				<s:tree theme="ajax" rootNode="%{groupTreeModel}"
>>>> 					childCollectionProperty="children" nodeIdProperty="id"
>>>> 					nodeTitleProperty="name" treeSelectedTopic="treeSelected">
>>>> 				</s:tree>
>>>>
>>>>      function treeNodeSelected(nodeId) {
>>>>      dojo.byId("id_group").value = nodeId;
>>>>      };   
>>>>      dojo.event.topic.subscribe("treeSelected", this,
>>>> "treeNodeSelected");
>>>>  </script>
>>>>
>>>> Thank you.
>>>>   
>>>>       
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%3Cs%3Atree-treeSelectedTopic-property-doesn%27t-fire-any-event-tf4304332.html#a12253245
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Posted by Manu Mahajan <ma...@comprotechnologies.com>.
Sorry about the link that came in because I copy pasted text from the 
web page and thunderbird copied the hyperlink as well. Please ignore the 
link. I assume you have got the correct tree.ftl file.

Please note that the parameter passed to the javascript callback 
function will not be the "nodeId" but it will be a dojo "message" object.

try replacing the following code

function treeNodeSelected(nodeId)
{
dojo.byId("id_group").value = nodeId;
}

with

function treeNodeSelected(message)
{ 
     dojo.byId("id_group").value = message.node.widgetId;
}

GEDA wrote:
> I did download the tree.ftl file from the file attachement but still doesn't
> work. The link you gave me is not an actual file but a diff file which I
> don't know how to use it. :(
>
>
> Manu Mahajan-2 wrote:
>   
>> Hi
>>
>> Try this. Create a directory template/ajax in your application and copy 
>> the file tree.ftl from this page
>> https://issues.apache.org/struts/browse/WW-1813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>> You can search for this string  
>> "/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl 
>> <http://svn.apache.org/viewcvs.cgi//struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl/?rev=528866&view=diff&r1=528866&r2=528865&p1=/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl&p2=/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl>" 
>>
>> (You'll find a link to the file modified on 14th Apr)
>>
>> Your code should work now. I just tested this with a standard 2.0.8 
>> showcase app.
>>
>> Manu
>>
>> GEDA wrote:
>>     
>>> Is there a workaround in order for this to work ?
>>>
>>> 				<s:tree theme="ajax" rootNode="%{groupTreeModel}"
>>> 					childCollectionProperty="children" nodeIdProperty="id"
>>> 					nodeTitleProperty="name" treeSelectedTopic="treeSelected">
>>> 				</s:tree>
>>>
>>>      function treeNodeSelected(nodeId) {
>>>      dojo.byId("id_group").value = nodeId;
>>>      };   
>>>      dojo.event.topic.subscribe("treeSelected", this,
>>> "treeNodeSelected");
>>>  </script>
>>>
>>> Thank you.
>>>   
>>>       
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>     
>
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Posted by GEDA <ge...@gmail.com>.
I did download the tree.ftl file from the file attachement but still doesn't
work. The link you gave me is not an actual file but a diff file which I
don't know how to use it. :(


Manu Mahajan-2 wrote:
> 
> Hi
> 
> Try this. Create a directory template/ajax in your application and copy 
> the file tree.ftl from this page
> https://issues.apache.org/struts/browse/WW-1813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> You can search for this string  
> "/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl 
> <http://svn.apache.org/viewcvs.cgi//struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl/?rev=528866&view=diff&r1=528866&r2=528865&p1=/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl&p2=/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl>" 
> 
> (You'll find a link to the file modified on 14th Apr)
> 
> Your code should work now. I just tested this with a standard 2.0.8 
> showcase app.
> 
> Manu
> 
> GEDA wrote:
>> Is there a workaround in order for this to work ?
>>
>> 				<s:tree theme="ajax" rootNode="%{groupTreeModel}"
>> 					childCollectionProperty="children" nodeIdProperty="id"
>> 					nodeTitleProperty="name" treeSelectedTopic="treeSelected">
>> 				</s:tree>
>>
>>      function treeNodeSelected(nodeId) {
>>      dojo.byId("id_group").value = nodeId;
>>      };   
>>      dojo.event.topic.subscribe("treeSelected", this,
>> "treeNodeSelected");
>>  </script>
>>
>> Thank you.
>>   
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%3Cs%3Atree-treeSelectedTopic-property-doesn%27t-fire-any-event-tf4304332.html#a12252786
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Posted by Manu Mahajan <ma...@comprotechnologies.com>.
Hi

Try this. Create a directory template/ajax in your application and copy 
the file tree.ftl from this page
https://issues.apache.org/struts/browse/WW-1813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
You can search for this string  
"/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl 
<http://svn.apache.org/viewcvs.cgi//struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl/?rev=528866&view=diff&r1=528866&r2=528865&p1=/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl&p2=/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl>" 

(You'll find a link to the file modified on 14th Apr)

Your code should work now. I just tested this with a standard 2.0.8 
showcase app.

Manu

GEDA wrote:
> Is there a workaround in order for this to work ?
>
> 				<s:tree theme="ajax" rootNode="%{groupTreeModel}"
> 					childCollectionProperty="children" nodeIdProperty="id"
> 					nodeTitleProperty="name" treeSelectedTopic="treeSelected">
> 				</s:tree>
>
>      function treeNodeSelected(nodeId) {
>      dojo.byId("id_group").value = nodeId;
>      };   
>      dojo.event.topic.subscribe("treeSelected", this, "treeNodeSelected");
>  </script>
>
> Thank you.
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org