Re: jss.require(...) code is not executed when using ajaxResponseRenderer.addCallback(new JavaScriptCallback())

2016-02-05 Thread Carlos Montero Canabal
Hi,

Your js file you required is a js module??? I use many times require in a 
callback in tapestry 5.4.0 and it works perfect.

Regards

Carlos Montero 

Enviado desde mi iPhone

> El 5 feb 2016, a las 2:15, g  escribió:
> 
> hello geoff,
> 
> thanks for your feedback, and indeed: I believe it looks very much
> like a tapestry 5.4 bug ;-)
> 
> thanks & kind regards, g.
> 
> On 5 February 2016 at 02:00, JumpStart
>  wrote:
>> Sorry, just looked at your stack overflow example and I’m baffled as to why 
>> it wouldn’t work.
>> 
>> Geoff
>> 
>>> On 5 Feb 2016, at 8:55 AM, JumpStart  
>>> wrote:
>>> 
>>> Here are some working examples that may help.
>>> 
>>> In a callback:
>>> 
>>>  
>>> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/modal/1
>>> 
>>> In afterRender:
>>> 
>>>  
>>> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/robust
>>> 
>>> Geoff
>>> 
 On 5 Feb 2016, at 6:52 AM, g  wrote:
 
 hello,
 
 I noticed some inconsistent behavior when calling
 "jss.require(javascript).invoke(functionname).with(arguments)".
 
 if the call is made inside a construct
 "ajaxResponseRenderer.addCallback(new JavaScriptCallback() {public
 void run(JavaScriptSupport jss);}", the javascript code is NOT
 executed, where calling the same code inside void afterRender(){}, it
 DOES get executed correctly.
 
 so, I think there is a problem/bug in the code of the current 5.4.0
 tapestry when processing the jss.require inside a
 JavaScriptCallback...
 my code works fine in 5.3.8 when using the jss.addScript() rather than
 the jss.require...
 
 I posted sample source code on stackoverflow, but have not gotten any
 feedback so far:
 http://stackoverflow.com/questions/35127426/ajaxresponserenderer-addcallback-calling-requirejavascript-is-never-executed-f
 
 thanks for your feedback, g.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: jss.require(...) code is not executed when using ajaxResponseRenderer.addCallback(new JavaScriptCallback())

2016-02-05 Thread danny de cock
yes, they are ajax calls...  I will produce a stripped-down version of
the project that illustrates the problem...  when adding a submit
button that executes the same javascript script or when called from
afterRender, it works, when called through the onAjaxEvent call, it
does not...

will upload the source  this evening...

thanks, g.

On 5 February 2016 at 13:00, JumpStart
 wrote:
> Crazy thought, but have you confirmed with a web inspector that your request 
> is XHR?
>
>> On 5 Feb 2016, at 6:59 PM, g  wrote:
>>
>> yes, the js file is a module and is found in META-INF/modules.
>>
>> the file looks as follows:
>> define(["jquery"], function($) {
>>var privateFunc = function(args) {
>>alert('bingo! it works! ==');
>>var arg=args.arg;
>>console.log('arg',arg);
>>};
>>return { publicFunc: privateFunc};
>>});
>>
>> this is a simplification of the javascript file of
>> https://stackoverflow.com/questions/18796381/tapestry-5-4-call-jquery-more-than-once
>>
>> the difference between my code and probably your and Geoff's code is
>> that I call the ajaxResponseRender.addCallback(...) directly from an
>> onAjaxEvent() method and that you are using the ajaxResponseRender it
>> only if request.isXHR() is true:
>>void onEventHandler(...) {
>>if (request.isXHR()) {
>>ajaxResponseRenderer.addCallback(new JavaScriptCallback...);
>>}
>>}
>>
>> where my handler is structured without the request test:
>>void onEventHandler(...) {
>>ajaxResponseRenderer.addCallback(new JavaScriptCallback...);
>>}
>>
>> I have already tested whether adding the test would solve the issue,
>> but to no avail...
>>
>> I am porting the cometd-demo from uklance (cf.
>> https://github.com/uklance/tapestry-cometd) to tapestry 5.4.  this is
>> a push application in which this addCallback structure without the
>> request.isXHR-test works fine in 5.3.8...
>>
>> thanks for your feedback, g.
>>
>> On 5 February 2016 at 11:23, Carlos Montero Canabal
>>  wrote:
>>> Hi,
>>>
>>> Your js file you required is a js module??? I use many times require in a 
>>> callback in tapestry 5.4.0 and it works perfect.
>>>
>>> Regards
>>>
>>> Carlos Montero
>>>
>>> Enviado desde mi iPhone
>>>
 El 5 feb 2016, a las 2:15, g  escribió:

 hello geoff,

 thanks for your feedback, and indeed: I believe it looks very much
 like a tapestry 5.4 bug ;-)

 thanks & kind regards, g.

 On 5 February 2016 at 02:00, JumpStart
  wrote:
> Sorry, just looked at your stack overflow example and I’m baffled as to 
> why it wouldn’t work.
>
> Geoff
>
>> On 5 Feb 2016, at 8:55 AM, JumpStart 
>>  wrote:
>>
>> Here are some working examples that may help.
>>
>> In a callback:
>>
>> 
>> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/modal/1
>>
>> In afterRender:
>>
>> 
>> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/robust
>>
>> Geoff
>>
>>> On 5 Feb 2016, at 6:52 AM, g  wrote:
>>>
>>> hello,
>>>
>>> I noticed some inconsistent behavior when calling
>>> "jss.require(javascript).invoke(functionname).with(arguments)".
>>>
>>> if the call is made inside a construct
>>> "ajaxResponseRenderer.addCallback(new JavaScriptCallback() {public
>>> void run(JavaScriptSupport jss);}", the javascript code is NOT
>>> executed, where calling the same code inside void afterRender(){}, it
>>> DOES get executed correctly.
>>>
>>> so, I think there is a problem/bug in the code of the current 5.4.0
>>> tapestry when processing the jss.require inside a
>>> JavaScriptCallback...
>>> my code works fine in 5.3.8 when using the jss.addScript() rather than
>>> the jss.require...
>>>
>>> I posted sample source code on stackoverflow, but have not gotten any
>>> feedback so far:
>>> http://stackoverflow.com/questions/35127426/ajaxresponserenderer-addcallback-calling-requirejavascript-is-never-executed-f
>>>
>>> thanks for your feedback, g.
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: 

Re: jss.require(...) code is not executed when using ajaxResponseRenderer.addCallback(new JavaScriptCallback())

2016-02-05 Thread JumpStart
Crazy thought, but have you confirmed with a web inspector that your request is 
XHR?

> On 5 Feb 2016, at 6:59 PM, g  wrote:
> 
> yes, the js file is a module and is found in META-INF/modules.
> 
> the file looks as follows:
> define(["jquery"], function($) {
>var privateFunc = function(args) {
>alert('bingo! it works! ==');
>var arg=args.arg;
>console.log('arg',arg);
>};
>return { publicFunc: privateFunc};
>});
> 
> this is a simplification of the javascript file of
> https://stackoverflow.com/questions/18796381/tapestry-5-4-call-jquery-more-than-once
> 
> the difference between my code and probably your and Geoff's code is
> that I call the ajaxResponseRender.addCallback(...) directly from an
> onAjaxEvent() method and that you are using the ajaxResponseRender it
> only if request.isXHR() is true:
>void onEventHandler(...) {
>if (request.isXHR()) {
>ajaxResponseRenderer.addCallback(new JavaScriptCallback...);
>}
>}
> 
> where my handler is structured without the request test:
>void onEventHandler(...) {
>ajaxResponseRenderer.addCallback(new JavaScriptCallback...);
>}
> 
> I have already tested whether adding the test would solve the issue,
> but to no avail...
> 
> I am porting the cometd-demo from uklance (cf.
> https://github.com/uklance/tapestry-cometd) to tapestry 5.4.  this is
> a push application in which this addCallback structure without the
> request.isXHR-test works fine in 5.3.8...
> 
> thanks for your feedback, g.
> 
> On 5 February 2016 at 11:23, Carlos Montero Canabal
>  wrote:
>> Hi,
>> 
>> Your js file you required is a js module??? I use many times require in a 
>> callback in tapestry 5.4.0 and it works perfect.
>> 
>> Regards
>> 
>> Carlos Montero
>> 
>> Enviado desde mi iPhone
>> 
>>> El 5 feb 2016, a las 2:15, g  escribió:
>>> 
>>> hello geoff,
>>> 
>>> thanks for your feedback, and indeed: I believe it looks very much
>>> like a tapestry 5.4 bug ;-)
>>> 
>>> thanks & kind regards, g.
>>> 
>>> On 5 February 2016 at 02:00, JumpStart
>>>  wrote:
 Sorry, just looked at your stack overflow example and I’m baffled as to 
 why it wouldn’t work.
 
 Geoff
 
> On 5 Feb 2016, at 8:55 AM, JumpStart 
>  wrote:
> 
> Here are some working examples that may help.
> 
> In a callback:
> 
> 
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/modal/1
> 
> In afterRender:
> 
> 
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/robust
> 
> Geoff
> 
>> On 5 Feb 2016, at 6:52 AM, g  wrote:
>> 
>> hello,
>> 
>> I noticed some inconsistent behavior when calling
>> "jss.require(javascript).invoke(functionname).with(arguments)".
>> 
>> if the call is made inside a construct
>> "ajaxResponseRenderer.addCallback(new JavaScriptCallback() {public
>> void run(JavaScriptSupport jss);}", the javascript code is NOT
>> executed, where calling the same code inside void afterRender(){}, it
>> DOES get executed correctly.
>> 
>> so, I think there is a problem/bug in the code of the current 5.4.0
>> tapestry when processing the jss.require inside a
>> JavaScriptCallback...
>> my code works fine in 5.3.8 when using the jss.addScript() rather than
>> the jss.require...
>> 
>> I posted sample source code on stackoverflow, but have not gotten any
>> feedback so far:
>> http://stackoverflow.com/questions/35127426/ajaxresponserenderer-addcallback-calling-requirejavascript-is-never-executed-f
>> 
>> thanks for your feedback, g.
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 



[5.4] request from javascript to Tapestry event

2016-02-05 Thread Nathan Quirynen

Hi,

I have finally started the process of updating to 5.4.
Some components have an initializer javascript where an eventlink url is 
passed as a parameter to be used as the url for a request from 
javascript to a Tapestry event.
To handle the response (zone updates, scripts, ..) I added in the 
request callback function the following:


$.get(spec.eventLink, function(r) {

if (r.zones) {
$.each(r.zones, function(zoneId){
$('#' + zoneId).tapestryZone("applyContentUpdate", 
r.zones[zoneId]);

});
}

if (r.updateZone) {
var spec = {
url: r.updateZone.url,
params: r.updateZone.params
};
$('#' + r.updateZone.zoneId).tapestryZone("update", spec);
}
$.tapestry.utils.loadScriptsInReply(r);

});

I thought this was not the best solution, but did not find another one 
at the moment and it worked.
Now in 5.4 it does not work anymore, so how do I have to fire requests 
to tapestry events from javascript and make it handle the response?


Nathan

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: [5.4] request from javascript to Tapestry event

2016-02-05 Thread Chris Poulsen
Have a look at http://tapestry.apache.org/current/coffeescript/ajax.html

-- 
Chris

On Fri, Feb 5, 2016 at 2:54 PM, Nathan Quirynen  wrote:

> Hi,
>
> I have finally started the process of updating to 5.4.
> Some components have an initializer javascript where an eventlink url is
> passed as a parameter to be used as the url for a request from javascript
> to a Tapestry event.
> To handle the response (zone updates, scripts, ..) I added in the request
> callback function the following:
>
> $.get(spec.eventLink, function(r) {
>
> if (r.zones) {
> $.each(r.zones, function(zoneId){
> $('#' + zoneId).tapestryZone("applyContentUpdate",
> r.zones[zoneId]);
> });
> }
>
> if (r.updateZone) {
> var spec = {
> url: r.updateZone.url,
> params: r.updateZone.params
> };
> $('#' + r.updateZone.zoneId).tapestryZone("update", spec);
> }
> $.tapestry.utils.loadScriptsInReply(r);
>
> });
>
> I thought this was not the best solution, but did not find another one at
> the moment and it worked.
> Now in 5.4 it does not work anymore, so how do I have to fire requests to
> tapestry events from javascript and make it handle the response?
>
> Nathan
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: [5.4] request from javascript to Tapestry event

2016-02-05 Thread Chris Poulsen
Faking a "click" on an invisible async eventlink could also be a very
simple way to get this working without having to mock around with much
javascript.

-- 
Chris

On Fri, Feb 5, 2016 at 3:04 PM, Chris Poulsen 
wrote:

> Have a look at http://tapestry.apache.org/current/coffeescript/ajax.html
>
> --
> Chris
>
> On Fri, Feb 5, 2016 at 2:54 PM, Nathan Quirynen <
> nat...@pensionarchitects.be> wrote:
>
>> Hi,
>>
>> I have finally started the process of updating to 5.4.
>> Some components have an initializer javascript where an eventlink url is
>> passed as a parameter to be used as the url for a request from javascript
>> to a Tapestry event.
>> To handle the response (zone updates, scripts, ..) I added in the request
>> callback function the following:
>>
>> $.get(spec.eventLink, function(r) {
>>
>> if (r.zones) {
>> $.each(r.zones, function(zoneId){
>> $('#' + zoneId).tapestryZone("applyContentUpdate",
>> r.zones[zoneId]);
>> });
>> }
>>
>> if (r.updateZone) {
>> var spec = {
>> url: r.updateZone.url,
>> params: r.updateZone.params
>> };
>> $('#' + r.updateZone.zoneId).tapestryZone("update", spec);
>> }
>> $.tapestry.utils.loadScriptsInReply(r);
>>
>> });
>>
>> I thought this was not the best solution, but did not find another one at
>> the moment and it worked.
>> Now in 5.4 it does not work anymore, so how do I have to fire requests to
>> tapestry events from javascript and make it handle the response?
>>
>> Nathan
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>


Re: jss.require(...) code is not executed when using ajaxResponseRenderer.addCallback(new JavaScriptCallback())

2016-02-05 Thread g
yes, the js file is a module and is found in META-INF/modules.

the file looks as follows:
define(["jquery"], function($) {
var privateFunc = function(args) {
alert('bingo! it works! ==');
var arg=args.arg;
console.log('arg',arg);
};
return { publicFunc: privateFunc};
});

this is a simplification of the javascript file of
https://stackoverflow.com/questions/18796381/tapestry-5-4-call-jquery-more-than-once

the difference between my code and probably your and Geoff's code is
that I call the ajaxResponseRender.addCallback(...) directly from an
onAjaxEvent() method and that you are using the ajaxResponseRender it
only if request.isXHR() is true:
void onEventHandler(...) {
if (request.isXHR()) {
ajaxResponseRenderer.addCallback(new JavaScriptCallback...);
}
}

where my handler is structured without the request test:
void onEventHandler(...) {
ajaxResponseRenderer.addCallback(new JavaScriptCallback...);
}

I have already tested whether adding the test would solve the issue,
but to no avail...

I am porting the cometd-demo from uklance (cf.
https://github.com/uklance/tapestry-cometd) to tapestry 5.4.  this is
a push application in which this addCallback structure without the
request.isXHR-test works fine in 5.3.8...

thanks for your feedback, g.

On 5 February 2016 at 11:23, Carlos Montero Canabal
 wrote:
> Hi,
>
> Your js file you required is a js module??? I use many times require in a 
> callback in tapestry 5.4.0 and it works perfect.
>
> Regards
>
> Carlos Montero
>
> Enviado desde mi iPhone
>
>> El 5 feb 2016, a las 2:15, g  escribió:
>>
>> hello geoff,
>>
>> thanks for your feedback, and indeed: I believe it looks very much
>> like a tapestry 5.4 bug ;-)
>>
>> thanks & kind regards, g.
>>
>> On 5 February 2016 at 02:00, JumpStart
>>  wrote:
>>> Sorry, just looked at your stack overflow example and I’m baffled as to why 
>>> it wouldn’t work.
>>>
>>> Geoff
>>>
 On 5 Feb 2016, at 8:55 AM, JumpStart  
 wrote:

 Here are some working examples that may help.

 In a callback:

  
 http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/modal/1

 In afterRender:

  
 http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/robust

 Geoff

> On 5 Feb 2016, at 6:52 AM, g  wrote:
>
> hello,
>
> I noticed some inconsistent behavior when calling
> "jss.require(javascript).invoke(functionname).with(arguments)".
>
> if the call is made inside a construct
> "ajaxResponseRenderer.addCallback(new JavaScriptCallback() {public
> void run(JavaScriptSupport jss);}", the javascript code is NOT
> executed, where calling the same code inside void afterRender(){}, it
> DOES get executed correctly.
>
> so, I think there is a problem/bug in the code of the current 5.4.0
> tapestry when processing the jss.require inside a
> JavaScriptCallback...
> my code works fine in 5.3.8 when using the jss.addScript() rather than
> the jss.require...
>
> I posted sample source code on stackoverflow, but have not gotten any
> feedback so far:
> http://stackoverflow.com/questions/35127426/ajaxresponserenderer-addcallback-calling-requirejavascript-is-never-executed-f
>
> thanks for your feedback, g.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org