If you want the columns to be an exact size, set the minimum and maximum
column widths and call resetColumnWidths() or set the resize policy to
FIXED.
The preferred width is exactly that, the width that the columns should
attempt to maintain if they can.  When the resize policy is set to
FILL_WIDTH, the table will update the column widths on every page load.
 When it is set to anything else, you must update the width manually
(although that is probably a bug).  Either way, the preferred width is not
guaranteed, but the minimum and maximum widths are.

Thanks,
John LaBanca
[email protected]


On Thu, May 7, 2009 at 7:11 PM, jay <[email protected]> wrote:

>
> I've set my table resize policy to UNCONSTRAINED. I then very
> carefully setup my ColumnDefinitions to have the right preferred size
> (because the user may have previously resized the columns, and I need
> to honor that size).
>
> What I've noticed, though, is that "out-of-the-box", my columns are
> *always* 80px wide (which seems to correspond to
> FixedWidthGrid.DEFAULT_COLUMN_WIDTH.
>
> It seems to me (and please...correct me if I'm misusing/abusing the
> PagingScrollTable) that when I set the table definition, it should be
> setting the column widths to their preferred size, rather than
> allowing the default size to kick in.
>
> FWIW, my work-around is to override setTableDefinition() as follows:
>
>  @Override
>  public void setTableDefinition(
>    TableDefinition<RowType> tableDefinition
>  ) {
>    super.setTableDefinition( tableDefinition );
>    refreshVisibleColumnDefinitions();
>
>    List<ColumnDefinition<RowType, ?>> columns =
> getVisibleColumnDefinitions();
>    for ( int index = 0, numCols = columns.size(); index < numCols;
> index++ ) {
>      setColumnWidth( index, columns.get
> ( index ).getPreferredColumnWidth() );
>    }
>  }
>
> Would problems be caused if this behavior was in the base class? (My
> goal is to have the PagingScrollTable "just work". I'll be the first
> to admit that what I consider "just working" may not work for
> others...)
>
> thanks,
>
> jay
> >
>

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to