PDA

View Full Version : Incorrect position and size from CellEditor in Grid!



Vadim Kolesnikov
6 Apr 2012, 3:38 AM
- GXT version: 2.2.5
- Host mode / web mode / both: All
- Browser and version: All
- Operating System: Windows 7

If resize or change scale in browser window and setting for GridView setForceFit(true) then incorrect position and size from CellEditor in EditorGrid.

You need added resize listener to grid in method doRender() for EditorSupport:


public void doRender() {
gridListener = new Listener<GridEvent<M>>() {
public void handleEvent(GridEvent<M> e) {
EventType type = e.getType();
if (type == Events.BodyScroll || type == Events.Resize) { // new
if (!ignoreScroll) {
stopEditing(true);
}
} else if (type == Events.CellClick || type == Events.CellDoubleClick) {
e.cancelBubble();
onCellDoubleClick(e);
}
}
};

grid.addListener(Events.Resize, gridListener); // new

grid.addListener(Events.BodyScroll, gridListener);

if (clicksToEdit == ClicksToEdit.ONE) {
grid.addListener(Events.CellClick, gridListener);
} else {
grid.addListener(Events.CellDoubleClick, gridListener);
}

grid.addStyleName("x-edit-grid");
if (GXT.isSafari) {
grid.el().setTop(0);
grid.el().setScrollTop(0);
grid.el().makePositionable();
}
}