Re: JSONLiteral breks zone refresh

2012-10-23 Thread bhorvat
btw the order is lost when the component is re-renderd in the zone. Could
this affect something? Could the before/after specification get lost in ajax
update?



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717192.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: JSONLiteral breks zone refresh

2012-10-23 Thread bhorvat
I need to initialize my custom mixin after autocomlete mixin, as my mixin is
adding stuff to autocomplete. So i guess that @MixinAfter has no interest to
me.

The InitializationPriority.LATE does help as it adds the calling at the end
I guess so it is initialized after the autocomplete. However I am not sure
why the before/after prefix in mixins specification doesnt work

I guess this is how it should be written, right?

 




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717191.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: JSONLiteral breks zone refresh

2012-10-23 Thread Thiago H de Paula Figueiredo
On Tue, 23 Oct 2012 19:25:52 -0200, bhorvat   
wrote:


Yes I have, actually it is part of my code, and I have just removed it  
since it works the same whether or not it  is there


Actually, it works in a different way, I just don't know it would make a  
difference when adding an initializer call with  
InitializationPriority.LATE, as the ordering of JS function calls is  
defined in JavaScript. For rendering additional stuff using a mixin, it  
would definitely make a huge difference. Without @MixinAfter, events are  
triggered in the mixin first, component later. With @MixinAfter, it's  
component first, mixin later.


--
Thiago H. de Paula Figueiredo

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



Re: JSONLiteral breks zone refresh

2012-10-23 Thread bhorvat
Yes I have, actually it is part of my code, and I have just removed it since
it works the same whether or not it  is there



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717189.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: JSONLiteral breks zone refresh

2012-10-23 Thread Thiago H de Paula Figueiredo
On Tue, 23 Oct 2012 19:21:21 -0200, bhorvat   
wrote:





However I am having one problem, I need to call my mixing after  
Autocomplete
and I have tried that with the after prefix but for some reason that  
didnt

work out. So have tried to add InitializationPriority.LATE as shown above
and that worked.

Any idea why the first approach didnt?


Have you tried annotating your mixin class with @MixinAfter?

--
Thiago H. de Paula Figueiredo

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



Re: JSONLiteral breks zone refresh

2012-10-23 Thread bhorvat
I see your point about it and yea it does make sense so I have give up on the
JSONLiteral. 

François I like your solution. I have implemented my Mixin like this 

@Import(library = {"submitautocomplete.js"})
public class SubmitAutocomplete {

@Environmental
private JavaScriptSupport javaScriptSupport;
@InjectContainer
private Field field;

void afterRender(MarkupWriter writer) {
String id = field.getClientId();

JSONObject config = new JSONObject();
config.put("id", id);

javaScriptSupport.addInitializerCall(InitializationPriority.LATE,
"submitAutocomplete", config);
}
}

and I call it 



However I am having one problem, I need to call my mixing after Autocomplete
and I have tried that with the after prefix but for some reason that didnt
work out. So have tried to add InitializationPriority.LATE as shown above
and that worked. 

Any idea why the first approach didnt? 

in my plugin? I dont see this in other such as the 
Also can you please post the link to kiwi I have no idea where to look for
it :)
   





--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717187.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: JSONLiteral breks zone refresh

2012-10-23 Thread Howard Lewis Ship
You are confusing JavaScript objects, instantiated in the browser,
with JSON, a protocol for transferring data between client and server.
By design, JSON is a subset of JavaScript, specifically for security
(and performance) reasons.

You are floundering on the idea that you can push something composed
entirely on the server and execute it directly in the browser. That's
not what you are allowed to do (and note that the JSONLiteral business
is a hack that, as you can see, breaks things unexpectedly).

Send JSON of your own design to the client, let client code compose
the options object passed to the API you are using. That is the
Tapestry way, that is the best approach.

You don't see this is bespoke applications, because bespoke
applications don't have to deal with composability the way reusable
components do.

On Tue, Oct 23, 2012 at 2:55 AM, bhorvat  wrote:
> François Facon-3 wrote
>> I guess your parser error is due to jQuery which reject function even
>> received from ajax call. I've encountered the problem with the plugin
>> Jeditable.
>> see the following commit
>>
>> https://github.com/got5/tapestry5-jquery/commit/818ae2a5594397ea7368237d081e40b2fa3edbbe
>>
>> As Thiago mentioned, this should be considered as a hack.
>> In your case, I guess it would be better to follow howard's
>> recommendation.
>> - load a plugin during render phase (mixin could do that)
>> - configure your plugin to listen to an event etc..
>
> Yea I have found the line in the Jquery itself that fails when parsing the
> JSON with the native call. So I guess there is nothing that can be done
> about this.
>
> Still though I am not sure why this approach would be consider a hack. The
> autocomplete plugin expects to get a function that should handle certain
> events, and passing JSON is a way to pass information to the plugin. It is
> the same as passing the configuration parameters such as "title" : "My
> title". So I would expect that the tapestry's (in this case
> tapestry5-jquery) implementation of the plugin handles all configuration
> that can be passed to the plugin, and not just the normal parameters.
>
> If I understood correctly what I should do is create a mixing that will be
> loaded the autocomplete during the rendering page and then pass the function
> as I have done so far because in that case it will have the function before
> I need to refresh the zone to reveal the automcomplete textfield?
>
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717166.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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



Re: JSONLiteral breks zone refresh

2012-10-23 Thread François Facon
This morning Emmanuel told me that we already  have a documentation
that explain how to do this kind of job?
He will push this doc in the kiwi soon.

Short Story :
create a jQuery plugin

(function( $ ) {

$.extend(Tapestry.Initializer, {
 customAutocomplete: function(specs) {


$("#"+specs.targetdID).autocomplete("option", "select",
function(event, ui){
   // closure fuction with your code
 });

});

}) ( jQuery );
{{/code}}

use the mixins to get the targetdID

2012/10/23 bhorvat :
> François Facon-3 wrote
>> I guess your parser error is due to jQuery which reject function even
>> received from ajax call. I've encountered the problem with the plugin
>> Jeditable.
>> see the following commit
>>
>> https://github.com/got5/tapestry5-jquery/commit/818ae2a5594397ea7368237d081e40b2fa3edbbe
>>
>> As Thiago mentioned, this should be considered as a hack.
>> In your case, I guess it would be better to follow howard's
>> recommendation.
>> - load a plugin during render phase (mixin could do that)
>> - configure your plugin to listen to an event etc..
>
> Yea I have found the line in the Jquery itself that fails when parsing the
> JSON with the native call. So I guess there is nothing that can be done
> about this.
>
> Still though I am not sure why this approach would be consider a hack. The
> autocomplete plugin expects to get a function that should handle certain
> events, and passing JSON is a way to pass information to the plugin. It is
> the same as passing the configuration parameters such as "title" : "My
> title". So I would expect that the tapestry's (in this case
> tapestry5-jquery) implementation of the plugin handles all configuration
> that can be passed to the plugin, and not just the normal parameters.
>
> If I understood correctly what I should do is create a mixing that will be
> loaded the autocomplete during the rendering page and then pass the function
> as I have done so far because in that case it will have the function before
> I need to refresh the zone to reveal the automcomplete textfield?
>
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717166.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> 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: JSONLiteral breks zone refresh

2012-10-23 Thread bhorvat
François Facon-3 wrote
> I guess your parser error is due to jQuery which reject function even
> received from ajax call. I've encountered the problem with the plugin
> Jeditable.
> see the following commit
> 
> https://github.com/got5/tapestry5-jquery/commit/818ae2a5594397ea7368237d081e40b2fa3edbbe
> 
> As Thiago mentioned, this should be considered as a hack.
> In your case, I guess it would be better to follow howard's
> recommendation.
> - load a plugin during render phase (mixin could do that)
> - configure your plugin to listen to an event etc..

Yea I have found the line in the Jquery itself that fails when parsing the
JSON with the native call. So I guess there is nothing that can be done
about this.

Still though I am not sure why this approach would be consider a hack. The
autocomplete plugin expects to get a function that should handle certain
events, and passing JSON is a way to pass information to the plugin. It is
the same as passing the configuration parameters such as "title" : "My
title". So I would expect that the tapestry's (in this case
tapestry5-jquery) implementation of the plugin handles all configuration
that can be passed to the plugin, and not just the normal parameters.

If I understood correctly what I should do is create a mixing that will be
loaded the autocomplete during the rendering page and then pass the function
as I have done so far because in that case it will have the function before
I need to refresh the zone to reveal the automcomplete textfield? 




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717166.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: JSONLiteral breks zone refresh

2012-10-23 Thread François Facon
Boris,

I guess your parser error is due to jQuery which reject function even
received from ajax call. I've encountered the problem with the plugin
Jeditable.
see the following commit

https://github.com/got5/tapestry5-jquery/commit/818ae2a5594397ea7368237d081e40b2fa3edbbe

As Thiago mentioned, this should be considered as a hack.
In your case, I guess it would be better to follow howard's recommendation.
- load a plugin during render phase (mixin could do that)
- configure your plugin to listen to an event etc..


2012/10/22 bhorvat :
> Yea I have submitted an issue and will see what they say about it.
>
> If however anyone has any idea how to implement this so that it is not
> related to the passing the function from the server code I would appreciate.
>
> cheers
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717146.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> 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: JSONLiteral breks zone refresh

2012-10-22 Thread bhorvat
Yea I have submitted an issue and will see what they say about it. 

If however anyone has any idea how to implement this so that it is not
related to the passing the function from the server code I would appreciate.

cheers



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717146.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: JSONLiteral breks zone refresh

2012-10-22 Thread Chris Poulsen
Hi,

You could take this up with the tapestry5-jquery people in their
google group, i guess it is not impossible to provide a patch and get
it accepted by them.

-- 
Chris

On Mon, Oct 22, 2012 at 7:18 PM, bhorvat  wrote:
> I agree, but still it is better then the alternative.
>
> Tapestry5-jquery team is providing the js file and if I override it then I
> will have to make sure that next release from them is not broken in my
> project as I have override one of their files.
>
> What I want to do is just pass the function in the configuration for the
> autocomponent. If you have any better ways to implement this please let me
> know.
>
> autocomplete that they use accepts the function as part of the configuration
> and the way I can send them that is from the code using the JSONLiteral. I
> have no idea how else can I pass the configuration without overriding their
> autocomplete.js file that tapestry5-jquery team is using
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717144.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> 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: JSONLiteral breks zone refresh

2012-10-22 Thread bhorvat
I agree, but still it is better then the alternative. 

Tapestry5-jquery team is providing the js file and if I override it then I
will have to make sure that next release from them is not broken in my
project as I have override one of their files.

What I want to do is just pass the function in the configuration for the
autocomponent. If you have any better ways to implement this please let me
know.

autocomplete that they use accepts the function as part of the configuration
and the way I can send them that is from the code using the JSONLiteral. I
have no idea how else can I pass the configuration without overriding their
autocomplete.js file that tapestry5-jquery team is using



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717144.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: JSONLiteral breks zone refresh

2012-10-22 Thread Thiago H de Paula Figueiredo
On Mon, 22 Oct 2012 14:48:13 -0200, bhorvat   
wrote:



Howard Lewis Ship wrote

Well, change that.  Have you Ajax response load a library containing
the function.


yea that is what I have done at the moment, I have added the code that  
needs to be executed when a user selects something form the list. But  
this is hack as I have overridden the original script to add my code.


I'm sorry, but IMHO returning a whole JavaScript function from server-side  
dynamically instead of having this function already declared in a .js file  
and calling it is a hack.


--
Thiago H. de Paula Figueiredo

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



Re: JSONLiteral breks zone refresh

2012-10-22 Thread bhorvat
Howard Lewis Ship wrote
> Well, change that.  Have you Ajax response load a library containing
> the function.

yea that is what I have done at the moment, I have added the code that needs
to be executed when a user selects something form the list. But this is hack
as I have overridden the original script to add my code. 

So obviously I need better solution as this a hack, which I was trying to do
by passing the function that I want to execute in the configuration which
breaks the zone refreshing 



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/JSONLiteral-breaks-zone-refresh-tapesty-jquery-tp5717101p5717142.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: JSONLiteral breks zone refresh

2012-10-22 Thread Howard Lewis Ship
On Mon, Oct 22, 2012 at 4:39 AM, bhorvat  wrote:
> Howard Lewis Ship wrote
>> What if the function already existed on some global object?
>
> The function should not exist anywhere before my code.

Well, change that.  Have you Ajax response load a library containing
the function.

> Here is what happens.
> The page is loaded, I click a link which refreshes a zone and then it
> reveals a textfield with autocomponent mixin. I am passing that JSONObject
> to options of the autocomponent mixin that will assign a function to the
> select event of the autocomponent (my idea is to submit the form on select -
> well to submit what the users has selected)
>
> public JSONObject getAutoUsersParams() {
>  JSONObject params = new JSONObject();
>  params.put("select", new JSONLiteral("function (event,ui)
> {alert(1)}"));
>  return params;
> }
>
> However the zone is simply not refreshed. But to answer the original
> question since the function is then inserted for the first time it does not
> exist anywhere else. When I go to debug I can see that on the server side
> everything happens as it should. Also the zone is refreshed if I dont pass
> the JSONLiteral. Also if I set that the textfield is visible at first load
> then the function is passed as it should, when I select the link to
> hide/show the edit mode it hides it, but then it wont show it on my next
> click.
>
> So the problem is only when I want to refresh the zone and I pass the
> JSONLiteral
>
>
> Howard Lewis Ship wrote
>>
>> What if the JSONObject you pass in is not passed directly to autocommit
>> code?
>
> hm...since I am not that good with js I have no idea what autocommit code
> is? Any suggestion how I can check this or what it is?
>
>
> Howard Lewis Ship wrote
>>
>> So you pass what I call a "spec", and it builds the options for the
>> autocommit itself.  You don't specify a function, you specify a
>> function name or reference.
>
> I am not quite positive what you want to explain to me here but if I
> understood you correctly this approach is not good for me. I dont want to
> execute the function when I refresh a zone I just want to pass the function
> to the select event of the autocomplete mixin. So calling addScript and
> passing a function sadly wont work for me
>
>
> Howard Lewis Ship wrote
>>
>> I'm not exactly sure why the Ajax case fails; I suspect something in
>> the Prototype portion of the pipeline is sanitizing the JSONObject to
>> defeat what you are attempting. I always start in the Network tab, to
>> see exactly what is being passed down to the client (I sometimes use
>> curl from the command line just to be certain there isn't some browser
>> caching getting in the way).
>
> I am using jquery (probably should have mention this before). In the Network
> tap I dont see anything wrong. Just that event is being triggered. However
> in the console I do see some error
>
> Communication with the server failed: null t5-console-jquery.js:64
> error t5-console-jquery.js:64
> $.extend.invokeLogger tapestry-jquery.js:160
> $.extend.error tapestry-jquery.js:120
> $.tapestry.utils.ajaxFailureHandler tapestry-jquery.js:1103
> fire jquery-1.7.2.js:1075
> self.fireWith jquery-1.7.2.js:1193
> done jquery-1.7.2.js:7540
> callback jquery-1.7.2.js:8324
> Ajax failure: Status 200 for #{request.url}: null
> Ajax failure: Status 200 for #{request.url}: null t5-console-jquery.js:56
>
> The cash is definitely not the problem I have checked that
>
> tnx for help
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/JSONLiteral-breks-zone-refresh-tp5717101p5717128.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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



Re: JSONLiteral breks zone refresh

2012-10-22 Thread bhorvat
Howard Lewis Ship wrote
> What if the function already existed on some global object?

The function should not exist anywhere before my code. Here is what happens. 
The page is loaded, I click a link which refreshes a zone and then it
reveals a textfield with autocomponent mixin. I am passing that JSONObject
to options of the autocomponent mixin that will assign a function to the
select event of the autocomponent (my idea is to submit the form on select -
well to submit what the users has selected)

public JSONObject getAutoUsersParams() { 
 JSONObject params = new JSONObject(); 
 params.put("select", new JSONLiteral("function (event,ui)
{alert(1)}")); 
 return params; 
} 

However the zone is simply not refreshed. But to answer the original
question since the function is then inserted for the first time it does not
exist anywhere else. When I go to debug I can see that on the server side
everything happens as it should. Also the zone is refreshed if I dont pass
the JSONLiteral. Also if I set that the textfield is visible at first load
then the function is passed as it should, when I select the link to
hide/show the edit mode it hides it, but then it wont show it on my next
click.

So the problem is only when I want to refresh the zone and I pass the
JSONLiteral


Howard Lewis Ship wrote
>  
> What if the JSONObject you pass in is not passed directly to autocommit
> code?

hm...since I am not that good with js I have no idea what autocommit code
is? Any suggestion how I can check this or what it is?


Howard Lewis Ship wrote
>  
> So you pass what I call a "spec", and it builds the options for the
> autocommit itself.  You don't specify a function, you specify a
> function name or reference. 

I am not quite positive what you want to explain to me here but if I
understood you correctly this approach is not good for me. I dont want to
execute the function when I refresh a zone I just want to pass the function
to the select event of the autocomplete mixin. So calling addScript and
passing a function sadly wont work for me


Howard Lewis Ship wrote
>  
> I'm not exactly sure why the Ajax case fails; I suspect something in
> the Prototype portion of the pipeline is sanitizing the JSONObject to
> defeat what you are attempting. I always start in the Network tab, to
> see exactly what is being passed down to the client (I sometimes use
> curl from the command line just to be certain there isn't some browser
> caching getting in the way).

I am using jquery (probably should have mention this before). In the Network
tap I dont see anything wrong. Just that event is being triggered. However
in the console I do see some error 

Communication with the server failed: null t5-console-jquery.js:64
error t5-console-jquery.js:64
$.extend.invokeLogger tapestry-jquery.js:160
$.extend.error tapestry-jquery.js:120
$.tapestry.utils.ajaxFailureHandler tapestry-jquery.js:1103
fire jquery-1.7.2.js:1075
self.fireWith jquery-1.7.2.js:1193
done jquery-1.7.2.js:7540
callback jquery-1.7.2.js:8324
Ajax failure: Status 200 for #{request.url}: null 
Ajax failure: Status 200 for #{request.url}: null t5-console-jquery.js:56

The cash is definitely not the problem I have checked that 

tnx for help



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/JSONLiteral-breks-zone-refresh-tp5717101p5717128.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: JSONLiteral breks zone refresh

2012-10-21 Thread Howard Lewis Ship
What if the function already existed on some global object?

What if the JSONObject you pass in is not passed directly to autocommit code?

So you pass what I call a "spec", and it builds the options for the
autocommit itself.  You don't specify a function, you specify a
function name or reference.

I'm not exactly sure why the Ajax case fails; I suspect something in
the Prototype portion of the pipeline is sanitizing the JSONObject to
defeat what you are attempting. I always start in the Network tab, to
see exactly what is being passed down to the client (I sometimes use
curl from the command line just to be certain there isn't some browser
caching getting in the way).

On Sun, Oct 21, 2012 at 2:27 AM, bhorvat  wrote:
> Hi,
>
> I have already wrote about a problem I was having in 2 different treads and
> I was finally able to figure out the solution for that. My problem was that
> I needed to pass the function to the autocomplete mixin.
>
> public JSONObject getAutoUsersParams() {
> JSONObject params = new JSONObject();
> params.put("select", new JSONLiteral("function (event,ui)
> {alert(1)}"));
> return params;
> }
>
> I pass this to the t:options of the autocomponent mixing and that is it. The
> problem now is that I have button that switches the edit mode on and off
> using the zones. And that doesnt work any more. If I am in the edit mode and
> I click back it does what is suppose to. However if i am not in the edit
> mode and it needs to initilzed the autocomponent using the code above...well
> nothing happens.
>
> Does anyone know why is this and how can I fix it?
>
> If I remove the JSONLiteral it all works great, so I am guessing that the
> problem is in the unquted literal that is passed when the zone is refreshed
> (which I have to do), but I am not sure why it is broken.
>
> Also I dont get any errors about this. Not in Chrome not in output.
>
> Any ideas would be appreciated
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/JSONLiteral-breks-zone-refresh-tp5717101.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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



JSONLiteral breks zone refresh

2012-10-21 Thread bhorvat
Hi, 

I have already wrote about a problem I was having in 2 different treads and
I was finally able to figure out the solution for that. My problem was that
I needed to pass the function to the autocomplete mixin.

public JSONObject getAutoUsersParams() {
JSONObject params = new JSONObject();
params.put("select", new JSONLiteral("function (event,ui)
{alert(1)}"));
return params;
}

I pass this to the t:options of the autocomponent mixing and that is it. The
problem now is that I have button that switches the edit mode on and off
using the zones. And that doesnt work any more. If I am in the edit mode and
I click back it does what is suppose to. However if i am not in the edit
mode and it needs to initilzed the autocomponent using the code above...well
nothing happens.

Does anyone know why is this and how can I fix it?

If I remove the JSONLiteral it all works great, so I am guessing that the
problem is in the unquted literal that is passed when the zone is refreshed
(which I have to do), but I am not sure why it is broken.

Also I dont get any errors about this. Not in Chrome not in output.

Any ideas would be appreciated



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/JSONLiteral-breks-zone-refresh-tp5717101.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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