Hi Derrell,

I tried your first choise with;


var form = this.setUserData("form", form) = new
firstQxApp.UploadForm('uploadFrm','/uploads/upload.php');

and
var response = this.getUserData("form").getIframeHtmlContent();

But know after generate.py source and build I will get this error:

invalid assignment left-hand side
var form = this.setUserData("for...('uploadFrm','/uploads/upload.php');

BUT, let us make it easier for testing:
I now tried to call the "getTableData" function in the addListener.

        form.addListener('completed',function(e) {
          this.getTableData();
         }, this);

In the FB Console I can see the result which seems ok.
But the function run in an exception.

Error while receiving table data: TypeError this.tableModel is undefined

    getTableData : function(){
      var req = new qx.io.remote.Request(
     "http://localhost/PA/mobilewebjobticket/getUserUploadFile.php";,
      "GET",
      "application/json");
      req.addListener("completed", function(e) {
          try
          {
             var content = e.getContent();
             if (content.length > 0) {
                    this.tableModel.setData(content);
             }//if
          }
          catch (e)
          {
                  alert("Error while receiving table data: " +
e.toString());
          }
      }, this);
      //req.setParameter("UserID", MyParam);
      req.setParameter("UserID", 3);
      req.send();
    },


I assume this is the same problem ?

best regards
Hansjoerg




2010/3/8 Derrell Lipman <[email protected]>

> On Mon, Mar 8, 2010 at 02:26, Qoodary <[email protected]> wrote:
>
>>
>> Hi Derrell, Hi list,
>> thank you very much for your help,
>>
>> I tried to add the the third parameter "this" to the addListener function.
>>
>> form.addListener('completed',function(e) {
>>         this.debug('completed');
>>        file.setFieldValue('');
>>        var response = this.getIframeHtmlContent();
>>        this.debug(response);
>>        ////////////////////////////////////////////////////////////////
>>                this.getTableData();
>>        ///////////////////////////////////////////////////////////////////
>>        wm1.close();
>> }, this);
>>
>> But now I get the error message;
>> this.getIframeHtmlContent is not a function
>>
>> I do not know how to change the code that both function will work?
>>
>
> Ah, sorry, I hadn't noticed that you were also accessing methods of the
> form.
>
> You have a couple of choices:
>
> Choice 1.
>
> In addition to assigning the form instance to a local variable as you're
> doing here:
>
>   var form = new firstQxApp.UploadForm('uploadFrm','/uploads/upload.php');
>
> assign it to a member variable of your application object as well:
>
>   var form = this.setUserData("form", form) = new
> firstQxApp.UploadForm('uploadFrm','/uploads/upload.php');
>
> Then, in your listener handler you can use:
>
>   var response = this.getUserData("form").getIframeHtmlContent();
>
> Choice 2.
>
> JavaScript has a concept of "closures" which allow a variable defined in
> one scope to retain its value in another scope even if the first scope goes
> away. If you're not familiar with closures, it's worth reading up on, as
> it's a powerful feature (and one that can be easily misused and cause memory
> leaks if used improperly).
>
> In this case, since the 'form' variable is active at the time that you
> define your listener, i.e. it references a firstQxApp.UploadForm object, you
> can reference that variable inside of your handler. Even if the outer scope
> in which the 'form' variable is used were to go away (which it doesn't, in
> your application), the use inside of your handler would retain its value.
> You can therefore simply change
>
>   this.getIframeHtmlContent()
>
> to
>
>   form.getIframeHtmloContent()
>
> and that 'form' object will be the one initialized prior to creation of
> your handler. This is the easiest solution, and a perfectly valid one, but
> if you're going to use closures, it's really worth reading up on them to
> know their pit-falls.
>
> Cheers,
>
> Derrell
>
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to