Prevent GWT EditTextCell from flipping when switching between edit and non-edit-mode
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
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).
精彩评论