Hi,
Had a quick look at this:1) they set dataGrid.setWidth("100%") - but
this just scales it to the width of the screen. 2) they do set fixed
column widths - have a look at initTableColumns()
They are some useful calls available. Have a look at the
JavaDoc:http://google-web-toolkit.googlecode.com/svn/javadoc/latest/
com/google/gwt/user/cellview/client/
DataGrid.html#setTableWidth(double,
com.google.gwt.dom.client.Style.Unit)
James
On Oct 23, 3:36 pm, misko237 <[email protected]> wrote:
> Yeah, it might be a solution (not so nice and clean, but solution)...
>
> But, look at 
> thishttp://gwt.google.com/samples/Showcase/Showcase.html#!CwDataGrid
>
> They've made GridTable without setting column width (there is no width
> attribute on any element).
>
> On Oct 22, 5:18 pm,jaga<[email protected]> wrote:
>
>
>
>
>
>
>
> > Okay - for the first solution I did as follows:
> > 1) for each row of data
> > 1.1) for each field
> > 1.1.1) count the number of characters
> > 1.1.2) keep a running maximum
> > 2) finally you have an array of maximum sizes where each index
> > corresponds to a column, e.g. List<Integer> maxes;
> > 3) for each cell column
> > 3.1) set the width to the maximum using the unit EM.
> > Note: this is likely to make the column a little bigger than required.
> > You can also try the Unit EX
>
> > HTH
>
> > On Oct 14, 2:13 pm, misko237 <[email protected]> wrote:
>
> > > I have tried with first solution, but I couldn't manage to read real
> > > cell element width. Did you succeed? Second solution is not an option
> > > for me.
>
> > > On Oct 13, 2:57 pm,jaga<[email protected]> wrote:
>
> > > > I have the same problem.
>
> > > > For me there are two solutions:
> > > > 1) calculate the maximum field width at runtime by inspecting the row
> > > > data. Then set the field header size.
> > > > 2) leave as stock and listen for a mouse click or similar on each
> > > > field header and then resize it.
>
> > > > On Oct 10, 2:49 pm, misko237 <[email protected]> wrote:
>
> > > > > I have a problem with DataGrid in gwt 2.4. I made table with
> > > > > CellTable, and everything worked fine. But I needed fixed header, and
> > > > > then just replaced CellTable with DataGrid. I had problem with .css
> > > > > file, but than has been resolved.
>
> > > > > Now, the problem is that every column have fixed width. I need each
> > > > > column width to be set as the widest cell in entire column.
>
> > > > > Can someone help to make old looking, but with fixed header.
>
> > > > > Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to