2

I have a Table with 3 columns, the left 2 are fixed-width. I am trying to make the third column fill the whole remaining table.

I have tried:

logTable.getTableColumnModel().set(2, {flex: 1});

But this did nothing to the column width.

Thanks in advance!

William Edmisten
  • 693
  • 5
  • 12
  • This demo does what you want clearly: http://www.qooxdoo.org/current/demobrowser/#table~Table_Resize_Columns.html – ScoPi Jan 18 '18 at 10:50

1 Answers1

3

The default table column model does not allow that, but the Resize table column model, `qx.ui.table.columnmodel.Resize, does. You can do something like this:

var table = new qx.ui.table.Table(
  tableModel, // previously defined, with 3 columns
  {
    // We want to handle the behavior of table column resizing
    tableColumnModel : function(obj)
    {
      return new qx.ui.table.columnmodel.Resize(obj);
    }
  });

// Use the Resize table column model to allow final column to consume
// remainder of space
var tcm = table.getTableColumnModel();
var resizeBehavior = tcm.getBehavior();

resizeBehavior.setWidth(0, 50);
resizeBehavior.setWidth(1, 140);
resizeBehavior.setWidth(2, "1*");

Enjoy.

Derrell

Derrell Lipman
  • 526
  • 2
  • 3
  • This works perfectly. Can you comment on the whole * in the "1*"? Is that the indicator that the column should fill the remaining space? – ScoPi Jan 18 '18 at 14:41
  • 1
    The Resize column model uses a `behavior` to describe what to do. One of the properties of a behavior is the `width` of a column, which can be either a number, for a fixed width, a string containing a percentage, e.g., "25%", or a number followed by an asterisk, e.g., "1*", which represents the flex value. (This predates the current flex system used elsewhere in qooxdoo, these days.) See http://www.qooxdoo.org/5.0.2/api/#qx.ui.table.columnmodel.resizebehavior.Default and in particular, the `width` parameter of the `setWidth` method. – Derrell Lipman Jan 18 '18 at 21:12