[EMAIL PROTECTED] writes:

> Hello,
>
> I would like to know how to set a fixed column width in a virtual tree. I
> first add the tree like this:
> --------------
> var tree = new qx.ui.treevirtual.TreeVirtual("Tree");
>          with (tree)
>          { set({
>                  left   : 550,
>                  top    : 30,
>                  width  : 400,
>                  height : 200,
>          border :qx.renderer.border.BorderPresets.getInstance().thinInset,
>                  statusBarVisible: false
>                });
>            setColumnWidth(0,400);
>            setAlwaysShowOpenCloseSymbol(true);
>
>          };
>          tree.addToDocument();
> ----------
> After that rows and leafs are added to the tree.
> When loading this i get the following debug messages:
> ---------------
> 16250 DEBUG: qx.ui.table.ResizeTableColumnModel[212]: onappear
> 016265 DEBUG: qx.ui.table.DefaultResizeBehavior[22]: computeColumnsFlexWidth
> 016265 DEBUG: qx.ui.table.DefaultResizeBehavior[22]: Width: 20/380
> 016265 DEBUG: qx.ui.table.DefaultResizeBehavior[22]: Flexible Count: 0
> 016281 DEBUG: qx.ui.table.DefaultResizeBehavior[22]: col 0: width=36
> ---------------
>
> How can i stop the resizing of the columns? The effect of resizing column
> 0 to 36px happens also when the event 'onverticalscrollbarchanged' is
> fired instead of 'onappear'.

The default column model for TreeVirtual is the ResizeTableColumnModel.
It allows you fine-grained control over the widths of each column,
whether fixed-width or "flex", with the ability to specify minimum and
maximum widths.  To specify that the first column should be a fixed
width of 200px, do this:

  var tree = new qx.ui.treevirtual.TreeVirtual("Tree");
  var resizeBehavior = tree.getTableColumnModel().getBehavior().
  resizeBehavior.setWidth(0, 200);

Look at examples/Table_1.html for more usage examples of resize
behaviors, and at the documentation for qx.ui.table.DefaultResizeBehavior.

If you truly want to specify a fixed width for all columns with no
automatic resizing of any columns, then replace this:

  var tree = new qx.ui.treevirtual.TreeVirtual("Tree");

with this:

  var custom =
    {
      tableColumnModel :
        function(obj)
        {
          return new qx.ui.table.TableColumnModel(obj);
        }
    };
  var tree = new qx.ui.treevirtual.TreeVirtual("Tree", custom);

This specifies that the tree is to use the normal table column model in
which you specify the fixed widths of each column, with no automatic
resizing.

Cheers,

Derrell

-------------------------------------------------------------------------
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