ok, i've figured out the following:
on
http://stanlemon.net/2013/03/16/jgrowl-1-2-11/
they write:
updated to jGrowl today that fixes an issue when triggering the shutdown
method

so i did download the latest version of jgrowl and hardcore replaced the
jquery.jgrowl.js
in the file the version 2.1.12 is mentioned, although i did download 2.1.13

Then i just rebooted my server and it works with
retour.put("beforeClose", new JSONLiteral("function(e,m) {alert('About
to close this notification!');}"));
but not with:
retour.put("beforeClose", "function(e,m) {alert('About to close this
notification!');}");
here i again get a:
TypeError: o.beforeClose.apply is not a function
....beforeClose.apply( notification ,
[notification,message,o,self.element] ) !== f...

so JSONLiteral seems the way to go, also my custom function is called
when i do a:
retour.put("beforeClose", new JSONLiteral("mybeforeclose"));

But what shall i do now?


Kind regards
David

Am 26.06.2013 21:35, schrieb D.R.:
> Hi,
>
> i already have played with JSONLiteral, but had no luck. If i do a:
> retour.put("beforeClose", new JSONLiteral("function(e,m) {alert('About
> to close this notification!');}"));
>
> it renders:
> "jGrowlAlertManager" : [
> {
> "dismissURL" : "/index.layout.jgrowl:dismiss",
> "jgrowl" : {
> "position" : "center",
> "beforeClose" : function(e,m) {alert('About to close this
> notification!');},
> "header" : "Error"
> }}]
>
> so without the quotes, but alert is not called.
>
> if i do a:
> retour.put("beforeClose", new JSONLiteral("alert('About to close this
> notification!')"));
>
> it renders:
> "jGrowlAlertManager" : [
> {
> "dismissURL" : "/index.layout.jgrowl:dismiss",
> "jgrowl" : {
> "position" : "center",
> "beforeClose" : alert('About to close this notification!'),
> "header" : "Error"
> }}]
>
> but the alert occurs when loading the page and not when closing the
> alert :-)
>
> I already had your suggestion in my focus to provide a function
> somewhere else and put only the functioncall in the json, but again with
> no luck:
> .tml:
>     <script type="text/javascript">
>     function mybeforeclose(){
>     alert('About to close this notification!');
>     }
>     </script>
>
> .java:
> retour.put("beforeClose", new JSONLiteral("mybeforeclose()"));
>
> It renders without the qoutes, but it is called when the page is loaded
> and not when closing the alert.
> Doing a:
> retour.put("beforeClose", "mybeforeclose()");
>
> it renders without the quotes, but nothing happens when closing the alert.
>
> I also tried without the brackets, all without luck :-(
>
> Seems that i am really the only one who is playing with tapestry-jquery
> jgrowl-alert? I can not believe :-)
>
> In addition: the latest jgrowl version is 1.2.13 but tapestry-jquery
> 3.3.6 uses jgrowl 1.2.6
>
>
> With kind regards
> David
>
>
> Am 26.06.2013 20:15, schrieb Thiago H de Paula Figueiredo:
>> On Wed, 26 Jun 2013 14:51:29 -0300, D.R. <d...@googlemail.com> wrote:
>>
>>> whoops,
>>>
>>> usually i declare my components in the page class, but in this project i
>>> wanted to write less code. I've checked the docs about expansions and
>>> this topic is now clear to me, thank you Thiago for your answer and your
>>> hint.
>> :)
>>
>>> You was right, i don't get this error anymore, but it still don't work
>>> properly:
>>>
>>> .tml:
>>> <t:jquery.jgrowl params="jgrowlparams" />
>>>
>>> .java:
>>>     public JSONObject getJgrowlParams()
>>>     {
>>>         JSONObject retour = new JSONObject();
>>>         retour.put("position", "center");
>>>         retour.put("header", "Error");
>>>         retour.put("beforeClose", "function(e,m) {alert('About to close
>>> this notification!');}");
>>>         return retour;
>>>     }
>> I guess you should use JSONLiteral when passing the function.
>> Otherwise, it'll be treated as an ordinary string. Please try this and
>> let us know the result.
>>
>> A mostly unrelated hint: instead of passing a function inside a
>> JSONObject, why don't you create this function in some .js file and
>> just pass it directly? Something like function myBeforeClose() {...}
>> in a .js file and then retour.put("beforeClose", "myBeforeClose"). I
>> haven't tested it, but it may work. Either way, the less JS code you
>> have in Java classes, putting them on .js files instead, the better.
>>


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

Reply via email to