3

I've noticed that my web application jumps around in cell width when I click into my EditTextCell.

As I've seen on http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTable it's possible to prevent that. Also I've seen solutions where EditTextCell is subclassed, which is not my favourite. But I don't quite understand why the Google Example doesn't jump around and mine does.

Are they using CSS to prevent that?

Here's some code of mine:

cellTable = new CellTable<MyTO>();
Column<MyTO, String> editableColumn = new Column<MyTO, String>(new EditTextCell()) {
@Override
public String getValue(MyTO my) {
  return my.getString();
}
};
editableColumn.setFieldUpdater(new FieldUpdater<MyTO, String>() {

@Override
public void update(int index, MyTO object,String value) {
object.setString(value);
dirty = true;
}
}); 

cellTable.addColumn(editableColumn, "Editable Column");

As far as I've seen through the Google Sample, no setWidth()-Method is called - but I could'nt find any notice that a custom CSS style is applied...

Any hints? Or maybe one of the google folks scans this too and can help?

Greetings, Chris

Chris
  • 1,119
  • 1
  • 8
  • 26

1 Answers1

2

You where right, Google sets an absolute Width to the colums. See e.g.

cellTable.setColumnWidth(checkColumn, 40, Unit.PX);

in the "Example" file. This prevents the column from jumping since it always has a fix size. If you look closly to at the cell when it is in edit mode you notice, that the textfield folows over the a little bit over (at least in IE).

Stefan
  • 14,826
  • 17
  • 80
  • 143
  • A well, you where right! Stupid to have not seen that. I've set the table to a width of 100% und absolute layout, and given PX-sizes to the columns. Now it looks way better, but when I resize the window, the underlying textbox of the editTextCells is larger than the column and gets cut off. This is also observable on the Google example :( – Chris Aug 25 '11 at 13:34
  • Well, finally I'll stay with the solution to re-implement the TextEditCell as Stas Kurilin posted on http://stackoverflow.com/questions/6274124/edittextcell-fieldupdater-width/6550348#6550348 – Chris Aug 26 '11 at 11:42