Yep, that's exact what i need! :D

I've tryied this before but like this:

var teste = new Array("a","b");

and didn't work :P


BTW....can i return an array in RPC call?




[EMAIL PROTECTED] escreveu:
> Jonis <[EMAIL PROTECTED]> writes:
> 
>> Hi again.
>>
>> After some tests, almost everything is working :)
>> Bu again, i need some help...
>>
>> if using this code:
>>
>>      if (itemId == 1) {
>>              mycall = rpc.callAsync(function(result, ex, id) {
>>              mycall = null;
>>              if (ex == null) {
>>                alert("Resultado (" + id + "): " + result);
>>              } else {
>>                alert("Async(" + id + ") exception: " + ex);
>>              }
>>            }, 
>> "echo",iNome.getValue(),iRg.getValue(),iCod.getValue(),tf1.getValue());
>>
>>      }
>>      if (itemId == 2) {
>>              mycall = rpc.callAsync(function(result, ex, id) {
>>              mycall = null;
>>              if (ex == null) {
>>                alert("Resultado (" + id + "): " + result);
>>              } else {
>>                alert("Async(" + id + ") exception: " + ex);
>>              }
>>            }, "echo","teste2");
>>
>>      }
>>
>>
>> bla bla bla....
>>
>> is there any way to do this IF with just one function and N params??
>> example:
>>
>> if (x=1) {
>>    $params = a.getvalue + b.getvalue + c.getvalur;
>> }
>> if (x=2) {
>>    $params = a.getvalue + b.getvalue + c.getvalur + i.getvalue + j.getvalue;
>> }
>>
>> // finally call the function
>> rpc.call(....., $params);
>>
>> is there any way to do this??
>>
>> As i can see in documentation, params must NOT be array.
> 
> Each parameter must be listed separately, not in an array.  That's not saying
> that the first (and possibly only) parameter, itself, can't be an array.
> 
> I'm not quite sure what you want to do, but maybe this will help...
> 
> By way of example, I'm using the PHP backend.  You could use this alternate
> server method to accept an array of items to be echoed instead of a single
> item:
> 
>     /**
>      * A derivative of the echo method, which accepts as its sole parameter,
>      * an array of items to echo.
>      *
>      * @param params
>      *   An array containing the parameters to this method
>      *
>      * @param error
>      *   An object of class JsonRpcError.
>      *
>      * @return
>      *   Success: The object containing the result of the method;
>      *   Failure: null
>      */
>     function method_echo_array($params, $error)
>     {
>         if (count($params) != 1)
>         {
>             $error->SetError(JsonRpcError_ParameterMismatch,
>                              "Expected 1 parameter; got " . count($params));
>             return $error;
>         }
> 
>         $result = "";
>         foreach ($params[0] AS $param)
>         {
>             $result .= $param;
>         }
>         return "Client said: [" . $result . "]";
>     }
> 
> Then your call would be something like this:
> 
>     var params = [ ];
>     if (x=1) {
>       params.push(a.getvalue);
>       params.push(b.getvalue);
>       params.push(c.getvalue);
>     }
>     if (x=2) {
>       params.push(a.getvalue); // did you really mean to repeat these three?
>       params.push(b.getvalue);
>       params.push(c.getvalue);
> 
>       params.push(i.getvalue);
>       params.push(j.getvalue);
>     }
> 
>     // finally call the function
>     mycall = rpc.callAsync(function(result, ex, id) {
>       mycall = null;
>       if (ex == null) {
>         alert("Resultado (" + id + "): " + result);
>       } else {
>         alert("Async(" + id + ") exception: " + ex);
>       }
>     }, "echo_array", params);
> 
> Derrell
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to