-----Derrell Lipman <[email protected]> wrote: -----
The problem is that you're mixing the nice new data binding stuff with the 
antique Table widget. The Table widget is wonderful, and there's not yet a data 
binding-version of it, so you need to do a bit of fiddling to get the two to 
work together.  

Data binding uses a class called qx.data.Array for its results. The reason is 
that it's all based on property value changes, so each element of a model must 
be a property. What you get back from your Rest method, then, is apparently a 
qx.data.Array value, not a native array.  

The Table widget predates (by many, many years), the advent of qx.data.Array 
and data binding. It accepts, as its model (for qx.ui.table.model.Simple), a 
native array.

The method toArray() of the qx.data.Array class converts the model stored in 
the qx.data.Array instance into a native array.  

So in fact, you just need to do what it's saying, which is to call the 
toArray() method on that qx.data.Array object you're getting in the event data, 
and pass that to tableModel.setData().  

Don't worry. There are plans for a data binding implementation of a Table. It 
just hasn't been done yet.

Here's my current code:

      var __tableModel = new qx.ui.table.model.Simple();
      __tableModel.setColumns([ "Date", "DelayAvg", "First", "Last" ]);

      var url = "/avg_checkin_times/" + label;
      var jsonFetcher = new qx.data.store.Json(null);
      jsonFetcher.addListener("loaded", function(e) {
        __tableModel.setData(e.getData().toArray());
        }, this);
      jsonFetcher.setUrl(url);

      var table = new qx.ui.table.Table(__tableModel).set({
        decorator: null
      });

I'm still getting a table with the right number of rows but the first column 
says "please use toArray() to see the content.

So I tried this:

      var url = "/avg_checkin_times/" + label;
      var jsonFetcher = new qx.data.store.Json(null);
      jsonFetcher.addListener("loaded", function(e) {
        tData = e.getData().toArray();
        tData1 = []
        for (item in tData) {
            tData1.push(item.toArray());
        }
        __tableModel.setData(tData1);
        }, this);
      jsonFetcher.setUrl(url);

Error says "item.toArray() is not a function".

I also tried it with tData = e.getData();

Same error.

I don't know what I'm doing wrong here. 

It would be very cool if you could tell the JSON fetcher to not even bother 
converting the results into Objects but keep them as native.  It would save a 
lot of processing on a big load if that could be toggled "up front", and it 
would solve problems like these (and using the JSON results with other 
Javascript tools).

Big thanks for the help!  I really need to get this working.
Scott
--



The content of this email does not necessarily represent the views/opinions of 
my employer, Masco Corporation. If you are not the intended recipient of this 
email, please let me know since that means it got to you in error. Please 
delete it from your computer system since it may contain privileged or 
confidential information intended for someone else.
 
Masco does its best to eliminate viruses and other malicious software in emails 
and attachments coming through its servers and so cannot be held responsible if 
malicious software is inadvertently imbedded in this communication.
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to