public CellFormatter cellFormatter = new CellFormatter();
public Element cellElement;
and then I made 2 methods that I found very useful within my class
that extends Grid:
public int getColumnWidth(int column) {
cellElement = cellFormatter.getElement(0, column);
return cellElement.getClientWidth();
}
public int getColumnOffset(int column) {
cellElement = cellFormatter.getElement(0, column);
return cellElement.getOffsetLeft();
}
in the getElement function you can specify a row also, but I chose to
use 0 because all my columns in a given row have the same width. Be
wary though, I've noticed it rounds. I used a similar method to get
the total width for the table, and then I subtracted all the column
widths while the borders were set to 0, and the result I got was -3.
So there is slight rounding going on, which is why I found the
getOffsetLeft method of Element so useful since its more accurate for
me to get exactly where something is placed.
Best of luck!
On May 31, 10:33 pm, spierce7 <spier...@gmail.com> wrote:
> I'm trying to find a way to get the specific width of each column
> individually within a grid. Height isn't as important, but I wouldn't
> mind knowing that either. I don't need the table total width, but
> rather specific columns.
>
> Getting the absolute location of a cell, column, or row might also
> work. I've been looking for over an hour now and can't seem to find a
> way.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment