Hi list,

I want to [ have to ;) ] change my table (model) dynamically during run-time.
The table does show 7 or 5 columns depending on an external switch.

What I did is creating my own RemoteTableModel that should handle this, but I
always get into problems when the "new" column count is less than the one
before. (I guess the columnModelRenderer does still want to render/access the
last 2 columns...)

What I'm currently doin' in my remoteTableModel is something like this:

----------------------- *snip * --------------------
qx.Class.define("app.foo.remoteTableModel",
{
  extend : qx.ui.table.model.Remote,

  //...
  properties :
  {
    /** The different table formats. */
    format :
    {
      check : [ "full", "basic" ],
      init  : "full",
      apply : "_applyFormat"
    }
  },

  members :
  {
    headers : {
      full : {
        names : [ "One", "Two", "Three", "Four", "Five", "Six", "Seven" ],
        ids   : [ 0, 3, 4, 5, 6, 1, 2 ] // backend data is kind o' shuffled ;)
      },
      basic : {
        names : [ "Column A", "Column B", "Column C", "Column D", "Column E" ],
        ids   : [ 0, 1, 2, 3, 4 ]
      }
    },

    //...
    _applyFormat : function(value, old)
    {
      if (value != old) {
        this.reloadData(); //... from the backend

        this.setColumns( this.headers[value].names, this.headers[value].ids );
        //
        for (var i=0,l=this.headers[value].ids.length; i<l; ++i) {
         this.setColumnSortable(i, true);
        }

      }
    }
    //...
  }
  //...
}
----------------------- *snip * --------------------
But this seems not to work 100% ...

Is this the way I should continue, or do I have to completely remove and
re-instantiate my table?
What is the best way to do it?

Searching the list, I only found this:

[Til Schneider wrote on 2006-12-20:]
> Changing the table model does currently not work. You have two 
> possibilities:
>    * use several tables
>    * use a proxy table model, but then the columns may not be changed.

...is this still valid with qooxdoo 0.7 ?

Regards,
   Kuddel


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to