Hi Thomas,

Thomas Bückemeyer wrote:
> I have a class like this:
> 
> qx.Class.define("Something",
> {
>    extend : qx.core.Object,
>       
>    construct : function(data) {
>      this.base(arguments);
>      var ergebnis = new String;
> .....
> },
> 
> members : {
> ...
> 
>    getAktionById : function(id) {
>          var inhalt = String;
>       var req = new qx.io.remote.Request (
>         "http://"; + window.location.hostname + 
> "/something.php?action=something&id=" + id,
>         "GET",
>           "text/plain");
> 
>          req.addListener("completed", function(e) {
>            ..
>          }
>          );
> 
>       req.send();
> },
> 
> I am looking for a way to get the content of the request in a class 
> variable "ergebnis" from Something, or - better - to return the content 
> in a variable of another class. Is that poosible?
If you want to set the data to the variable "ergebnis" you have to turn 
it into an instance variable.

--snip--
// instead of
var ergebnis = new String();

// write
this.ergebnis = "";
--snip--

Or if you want to set the content of response to another variable of a 
class you have to have access to this other class inside your 
"completed" listener.

--snip--
// the third parameter is the context in which the listener is executed
req.addListener("completed", function(e) {
   // e is a "qx.io.remote.Response" instance
   var content = e.getContent();

   // this refers to your application class "Something"
   // supposed you have set "this.anotherClassInstance"
   // previously in your code
   this.anotherClassInstance.setVariable(content);
}, this);
--snip--

If you any further questions let me know.

cheers,
   Alex

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to