Hello All,

I think that I have found a bug with the setColumns method.

I have code that does the following:

        var table_model = new qx.ui.table.model.Simple();
        var columns = [""];
        table_model.setColumns(columns);

        var row_data = [];
        table_model.setData(row_data);

        /*
         * Get the data from the database as a side effect table model 
will be updated.          * This does an asynchronous call which is *not 
guaranteed* to finish before
         * the view creation code is called!!! The true number of 
columns is *not* known
         * until after this call.
         */
        this.get_custom_report_data(queryString, table_model); // (1)

        /* Create the view */
        var view = new qx.ui.table.Table(table_model); // (2)

The problem is that once the view i.e. qx.ui.table.Table is created, 
attempting to 'reset' the columns does not work by a 
table_model.setColumns(column_data.  This becomes critical when the 
number of columns is not known before hand, but is being pulled back 
asynchronously so that there is no guarantee that (2) will not be 
executed before (1) is complete.

At the moment, my hack is to implement a 'refresh' button that totally 
destroys the table and then recreates it (hopefully after the async call 
is done).

The correct seems to be a combination of:
a) an event listener that listens to when the async call is complete
b) to correct the 'bug' in table model so that it will refresh the ui 
when a setColumns call is made

Any ideas?

Kirk.

BTW, here is my handler call


        /*
         * Define our handler function, which will be called asynchronously
         */
        function handler(result, ex, id) {
            if (ex == null) {
                var data_result = result;
                if (data_result.length == 0) {
                    return;
                }

                table_model.setColumns(data_result[0]);

                var new_data = [];
                for (var i = 0; i < data_result.length; i++) {
                    var data_result_item = data_result[i];
                    new_data.push(data_result_item);
                    this.info("The new data is : " + data_result_item);
                }
                table_model.setData(new_data); /* update the ui (we 
hope) !*/
            }
            else {
                alert("Async(" + id + ") exception: " + ex);
            }
        }


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to