First, I am using the latest, Tapestry/Tapestry-JQuery versions: 5.3.7 / 3.3.7.

I created draganddrop.js and put it under webapp/js. It has a simple function:

function aaa() {
   alert();
}

In Java, I added the code like this:

@Inject
private AssetSource as;

@Inject
private JavaScriptSupport js;

@AfterRender
public void afterRender() {
    js.importJavaScriptLibrary(as.getContextAsset("js/draganddrop.js", null);
}

So the JavaScript should be imported (I successfully imported other js scripts 
this way)....

Then in the same Java class I edited the JSON params to now have:

options.put("start", new JSONLiteral("aaa"));

But I got the same Ajax error, communication with the server failed: null.



On Thursday, 20 March 2014 11:35 AM, Thiago H de Paula Figueiredo 
<thiag...@gmail.com> wrote:
 
I think this (passing a JavaScript parameter from the server side) is not  
recommended anyway. Create this function in some .js file which you  
include in your page or component then pass options.put("start", new  
JSONLiteral("nameOfTheFunction"));


On Thu, 20 Mar 2014 10:15:05 -0300, john c <john998...@yahoo.com> wrote:

> With <t:jquery.Draggable /> you can specify the JSONObject params like  
> so: t:params="params"
> In Java I have code like this (snippet):
>
> public JSONObject getParams() {
> JSONObject options = new JSONObject();
> ......
> ......
> options.put("start", "function() {$(this).hide();}");
> return options;
> }
>
> This "start" option does not seem to work as a String. I have tried  
> JSONLiteral but it failed also. I got a Ajax error, something like  
> Communication with the server failed, null.
>
> I also tried in the tml -- t:params="literal:{start: function()  
> {$(this).hide();}}"
>
> But it does not work. In both cases above I tried with arguments:  
> function(event, ui) {}, but it did not work.
>
> How can I declare this function ??
>
> Thanks.
> Reply, Re


-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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

Reply via email to