You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Andrey (JIRA)" <de...@tapestry.apache.org> on 2010/07/14 09:23:57 UTC

[jira] Created: (TAPESTRY-2766) javascaript does no rerender in inner component

javascaript does no rerender in inner component
-----------------------------------------------

                 Key: TAPESTRY-2766
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2766
             Project: Tapestry
          Issue Type: Bug
    Affects Versions: 4.1.6, 4.1.2
            Reporter: Andrey


I have page and Component inside it with Component.script included. Component first state is hidden, by if around it, ajax call change state of if and rerenders it but script is not on the page(bodyscript)

Code Example
Page(show initial value is false, onRefresh change it to true and vice versa)
<span jwcid="div@Any">	
      <span jwcid="@If" condition="ognl:show">
		 	<span jwcid="@Component" updateComponents="ognl:{'some'}" renderTag="false"/>
      </span>
 </span>

<a jwcid="@DirectLink" listener="listener:onRefresh" async="ognl:true" updateComponents="ognl:{'div'}">Refresh</a>

Component:

<span script="Component.script" jwcid="Component@Script"  type="text/javascript"/>
use script from Component script


	

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TAPESTRY-2766) javascaript does no rerender in inner component

Posted by "Andrey (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey updated TAPESTRY-2766:
-----------------------------


The script actualy came in ajax response but don't appear in DOM

Example(Componet is a @Body element)
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
<!ENTITY nbsp '&#160;'>
]>
<ajax-response><response id="bodyscript" type="script"><script>
<![CDATA[
function main_comp()
        {
        	alert(1);
        }
]]>
</script></response><response id="div" type="element"><span id="div">	
		 <span id="If">
		 	
<body id="Body">

    
	<!-- This main component -->
	 <br/>
	 <a href="#" onclick="javascript:main_comp();">Test</a>
	 <br/>
	 	
</body>
		 </span>
	 </span></response></ajax-response>

> javascaript does no rerender in inner component
> -----------------------------------------------
>
>                 Key: TAPESTRY-2766
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2766
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.1.2, 4.1.6
>            Reporter: Andrey
>
> I have page and Component inside it with Component.script included. Component first state is hidden, by if around it, ajax call change state of if and rerenders it but script is not on the page(bodyscript)
> Code Example
> Page(show initial value is false, onRefresh change it to true and vice versa)
> <span jwcid="div@Any">	
>       <span jwcid="@If" condition="ognl:show">
> 		 	<span jwcid="@Component" updateComponents="ognl:{'some'}" renderTag="false"/>
>       </span>
>  </span>
> <a jwcid="@DirectLink" listener="listener:onRefresh" async="ognl:true" updateComponents="ognl:{'div'}">Refresh</a>
> Component:
> <span script="Component.script" jwcid="Component@Script"  type="text/javascript"/>
> use script from Component script
> 	

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (TAPESTRY-2766) javascaript does no rerender in inner component

Posted by "Andreas Andreou (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Andreou resolved TAPESTRY-2766.
---------------------------------------

      Assignee: Andreas Andreou
    Resolution: Not A Problem

Because the script is evaluated by Tapestry in an anonymous context,
the main_comp() function definition is executed as normal but then the context 
is closed, so the function is lost!

The way you want to define the function is by attaching it yourself in the correct context -
for instance try:

window.main_comp = function() {
        	alert(1);  } 

or document.main_comp = ...
if you want it to be globally available




> javascaript does no rerender in inner component
> -----------------------------------------------
>
>                 Key: TAPESTRY-2766
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2766
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.1.2, 4.1.6
>            Reporter: Andrey
>            Assignee: Andreas Andreou
>
> I have page and Component inside it with Component.script included. Component first state is hidden, by if around it, ajax call change state of if and rerenders it but script is not on the page(bodyscript)
> Code Example
> Page(show initial value is false, onRefresh change it to true and vice versa)
> <span jwcid="div@Any">	
>       <span jwcid="@If" condition="ognl:show">
> 		 	<span jwcid="@Component" updateComponents="ognl:{'some'}" renderTag="false"/>
>       </span>
>  </span>
> <a jwcid="@DirectLink" listener="listener:onRefresh" async="ognl:true" updateComponents="ognl:{'div'}">Refresh</a>
> Component:
> <span script="Component.script" jwcid="Component@Script"  type="text/javascript"/>
> use script from Component script
> 	

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TAPESTRY-2766) javascaript does no rerender in inner component

Posted by "Andrey (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey updated TAPESTRY-2766:
-----------------------------


I tried you solution and it didn't worked
As I understand Component should be able to activate it own scripts.
Script working only if first time component is shown and there is full page refresh
I don't clearly understand your answer could you explain it in a different way
I'm attaching poc to issue


> javascaript does no rerender in inner component
> -----------------------------------------------
>
>                 Key: TAPESTRY-2766
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2766
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.1.2, 4.1.6
>            Reporter: Andrey
>            Assignee: Andreas Andreou
>
> I have page and Component inside it with Component.script included. Component first state is hidden, by if around it, ajax call change state of if and rerenders it but script is not on the page(bodyscript)
> Code Example
> Page(show initial value is false, onRefresh change it to true and vice versa)
> <span jwcid="div@Any">	
>       <span jwcid="@If" condition="ognl:show">
> 		 	<span jwcid="@Component" updateComponents="ognl:{'some'}" renderTag="false"/>
>       </span>
>  </span>
> <a jwcid="@DirectLink" listener="listener:onRefresh" async="ognl:true" updateComponents="ognl:{'div'}">Refresh</a>
> Component:
> <span script="Component.script" jwcid="Component@Script"  type="text/javascript"/>
> use script from Component script
> 	

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TAPESTRY-2766) javascaript does no rerender in inner component

Posted by "Andrey (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey updated TAPESTRY-2766:
-----------------------------


I tried you solution and it didn't worked
As I understand Component should be able to activate it own scripts.
Script working only if first time component is shown and there is full page refresh
I don't clearly understand your answer could you explain it in a different way
I'm attaching poc to issue


> javascaript does no rerender in inner component
> -----------------------------------------------
>
>                 Key: TAPESTRY-2766
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2766
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.1.2, 4.1.6
>            Reporter: Andrey
>            Assignee: Andreas Andreou
>
> I have page and Component inside it with Component.script included. Component first state is hidden, by if around it, ajax call change state of if and rerenders it but script is not on the page(bodyscript)
> Code Example
> Page(show initial value is false, onRefresh change it to true and vice versa)
> <span jwcid="div@Any">	
>       <span jwcid="@If" condition="ognl:show">
> 		 	<span jwcid="@Component" updateComponents="ognl:{'some'}" renderTag="false"/>
>       </span>
>  </span>
> <a jwcid="@DirectLink" listener="listener:onRefresh" async="ognl:true" updateComponents="ognl:{'div'}">Refresh</a>
> Component:
> <span script="Component.script" jwcid="Component@Script"  type="text/javascript"/>
> use script from Component script
> 	

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TAPESTRY-2766) javascaript does no rerender in inner component

Posted by "Andrey (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey updated TAPESTRY-2766:
-----------------------------

    Comment: was deleted

(was: I tried you solution and it didn't worked
As I understand Component should be able to activate it own scripts.
Script working only if first time component is shown and there is full page refresh
I don't clearly understand your answer could you explain it in a different way
I'm attaching poc to issue
)

> javascaript does no rerender in inner component
> -----------------------------------------------
>
>                 Key: TAPESTRY-2766
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2766
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.1.2, 4.1.6
>            Reporter: Andrey
>            Assignee: Andreas Andreou
>
> I have page and Component inside it with Component.script included. Component first state is hidden, by if around it, ajax call change state of if and rerenders it but script is not on the page(bodyscript)
> Code Example
> Page(show initial value is false, onRefresh change it to true and vice versa)
> <span jwcid="div@Any">	
>       <span jwcid="@If" condition="ognl:show">
> 		 	<span jwcid="@Component" updateComponents="ognl:{'some'}" renderTag="false"/>
>       </span>
>  </span>
> <a jwcid="@DirectLink" listener="listener:onRefresh" async="ognl:true" updateComponents="ognl:{'div'}">Refresh</a>
> Component:
> <span script="Component.script" jwcid="Component@Script"  type="text/javascript"/>
> use script from Component script
> 	

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TAPESTRY-2766) javascaript does no rerender in inner component

Posted by "Andrey (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey updated TAPESTRY-2766:
-----------------------------

    Comment: was deleted

(was: I tried you solution and it didn't worked
As I understand Component should be able to activate it own scripts.
Script working only if first time component is shown and there is full page refresh
I don't clearly understand your answer could you explain it in a different way
I'm attaching poc to issue
)

> javascaript does no rerender in inner component
> -----------------------------------------------
>
>                 Key: TAPESTRY-2766
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2766
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.1.2, 4.1.6
>            Reporter: Andrey
>            Assignee: Andreas Andreou
>
> I have page and Component inside it with Component.script included. Component first state is hidden, by if around it, ajax call change state of if and rerenders it but script is not on the page(bodyscript)
> Code Example
> Page(show initial value is false, onRefresh change it to true and vice versa)
> <span jwcid="div@Any">	
>       <span jwcid="@If" condition="ognl:show">
> 		 	<span jwcid="@Component" updateComponents="ognl:{'some'}" renderTag="false"/>
>       </span>
>  </span>
> <a jwcid="@DirectLink" listener="listener:onRefresh" async="ognl:true" updateComponents="ognl:{'div'}">Refresh</a>
> Component:
> <span script="Component.script" jwcid="Component@Script"  type="text/javascript"/>
> use script from Component script
> 	

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (TAPESTRY-2766) javascaript does no rerender in inner component

Posted by "Andreas Andreou (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Andreou resolved TAPESTRY-2766.
---------------------------------------

      Assignee: Andreas Andreou
    Resolution: Not A Problem

Because the script is evaluated by Tapestry in an anonymous context,
the main_comp() function definition is executed as normal but then the context 
is closed, so the function is lost!

The way you want to define the function is by attaching it yourself in the correct context -
for instance try:

window.main_comp = function() {
        	alert(1);  } 

or document.main_comp = ...
if you want it to be globally available




> javascaript does no rerender in inner component
> -----------------------------------------------
>
>                 Key: TAPESTRY-2766
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2766
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.1.2, 4.1.6
>            Reporter: Andrey
>            Assignee: Andreas Andreou
>
> I have page and Component inside it with Component.script included. Component first state is hidden, by if around it, ajax call change state of if and rerenders it but script is not on the page(bodyscript)
> Code Example
> Page(show initial value is false, onRefresh change it to true and vice versa)
> <span jwcid="div@Any">	
>       <span jwcid="@If" condition="ognl:show">
> 		 	<span jwcid="@Component" updateComponents="ognl:{'some'}" renderTag="false"/>
>       </span>
>  </span>
> <a jwcid="@DirectLink" listener="listener:onRefresh" async="ognl:true" updateComponents="ognl:{'div'}">Refresh</a>
> Component:
> <span script="Component.script" jwcid="Component@Script"  type="text/javascript"/>
> use script from Component script
> 	

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TAPESTRY-2766) javascaript does no rerender in inner component

Posted by "Andrey (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey updated TAPESTRY-2766:
-----------------------------


The script actualy came in ajax response but don't appear in DOM

Example(Componet is a @Body element)
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
<!ENTITY nbsp '&#160;'>
]>
<ajax-response><response id="bodyscript" type="script"><script>
<![CDATA[
function main_comp()
        {
        	alert(1);
        }
]]>
</script></response><response id="div" type="element"><span id="div">	
		 <span id="If">
		 	
<body id="Body">

    
	<!-- This main component -->
	 <br/>
	 <a href="#" onclick="javascript:main_comp();">Test</a>
	 <br/>
	 	
</body>
		 </span>
	 </span></response></ajax-response>

> javascaript does no rerender in inner component
> -----------------------------------------------
>
>                 Key: TAPESTRY-2766
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2766
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.1.2, 4.1.6
>            Reporter: Andrey
>
> I have page and Component inside it with Component.script included. Component first state is hidden, by if around it, ajax call change state of if and rerenders it but script is not on the page(bodyscript)
> Code Example
> Page(show initial value is false, onRefresh change it to true and vice versa)
> <span jwcid="div@Any">	
>       <span jwcid="@If" condition="ognl:show">
> 		 	<span jwcid="@Component" updateComponents="ognl:{'some'}" renderTag="false"/>
>       </span>
>  </span>
> <a jwcid="@DirectLink" listener="listener:onRefresh" async="ognl:true" updateComponents="ognl:{'div'}">Refresh</a>
> Component:
> <span script="Component.script" jwcid="Component@Script"  type="text/javascript"/>
> use script from Component script
> 	

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.