On Mon, Mar 8, 2010 at 09:47, Qoodary Doo <[email protected]> wrote:
> Hi Derrell,
>
> now it works!
>
Great! But let's talk about your solution...
> I am so happy. Thanks a lot for your help and your patience.
>
You're welcome.
> I have now added two addListener. One for callling my getTableData function
> and one for getIframeContent
>
> * form.addListener('completed',function(e) {
> this.getTableData();
> }, this);
> *
>
>
> * form.addListener('completed',function(e) {
>
> this.debug('completed');
> file.setFieldValue('');
> var response = this.getIframeHtmlContent();
> this.debug(response);
> wm1.close();
> });
> *
Although this works, it's (a) not the most efficient way to do it because
two separate event handlers must be called for the same event, and (b) it
makes your code a bit more difficult to read than necessary, since you're
handing a "completed" event in two different places. Using either of the
methods I described in a previous message (closure of form, or saving the
form variable as user data in the Application object) would allow you to use
only a single event and handler function.
**Then I have changed
> var tableModel = new qx.ui.table.model.Simple();
>
> to
>
> tableModel = new qx.ui.table.model.Simple();
>
> and in the function from
> this.tableModel.setData(content);
> to
> tableModel.setData(content);
>
> I do not know if this is ok or if this is proper code but for the moment it
> works finde :-)
>
Nope, you definitely don't want to do this. What you've done is changed
tableModel from being a variable local to your method of the Application
class, to being a GLOBAL variable. Bad, bad, bad. :-) For many reasons, you
should try to avoid global variables nearly always. All of qooxdoo has only
a single global variable, qx, and thus qooxdoo plays well with other
well-written JavaScript packages that also avoid polluting the global
namespace.
You were on the right track before you changed your function. Replace
var tableModel = new qx.ui.table.model.Simple();
with
this.tableModel = new qx.ui.table.model.Simple();
which allows your function to access this.tableModel.setData().
It sounds like you're well on your way!
Derrell
------------------------------------------------------------------------------
Download Intel® 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