On Sun, Mar 11, 2012 at 09:56, slah <[email protected]> wrote:

> Hi,
>
> I'm using qx.io.remote.Rpc to query a JSON-RPC server (rpcphp) and I'd like
> to call the callAsync method and provide params as array or json instead of
> comma separated params.
>
> I mean callAsync(handler, method, params); where params is an array of
> params instead of callAsync(handler, method, param1, param2, ..., paramn);
>
> Is it possible to achieve this and how?
>

It's not possible to pass the array of parameters in place of separate
arguments (with the current implementation of the Rpc class), but you can
accomplish what you desire with something like this:

// Instantiate an RPC object
var rpc = new qx.io.remote.Rpc(url, serviceName);

// Assuming your arguments to the RPC are in an array called params,
// prepend the first two parameters to callAsync (handler and methodname)
// to the front of the array.
params.unshift(handler, methodName);

// Now call the callAsync function using a Function object's apply method.
rpc.callAsync.apply(rpc, params);

I may not have the syntax of these quite right, but this gives you the
general idea.

Derrell
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to