Hello,
>> I make a rpc that updates table data. I want to call a method inside the rpc
>> callback function lieke this:
>>
>> mycall = rpc.callAsync(function(result, ex, id) {
>>
>> if (ex == null)
>> {
>> this.openWindow();
>>
>> .....
>> ...
>>
>>
>
> 'this' depends upon the context of the call, which is why you're not finding
> it available. The easiest way to solve the problem is to declare a variable
> outside of the event, and assign 'this' to it. It'll then be available within
> your event's callbcak method.
>
>
> var _this = this;
>
> mycall = rpc.callAsync(function(result, ex, id) {
>
> if (ex == null)
> {
> _this.openWindow();
>
In other places of the framework we define an additional parameter for
'this' if a callback parameter is required. For example
"addEventListener" bahaves this way. Wouldn't it make sense to add a
'this' parameter to 'callAsync' as well to be more consistent with the
framework and avoid such hacks?
Best Fabian
-------------------------------------------------------------------------
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