We recently encountered a problem in SmartClient Version: v9.1p_2014-04-29/Pro Deployment (built 2014-04-29) where new ListGrid rows with validation errors disappear from the grid. Tested in Firefox 26.0 and Chrome 35.0.1916.153
I found this post that describes the symptoms we were seeing and a suggested workaround until a fix is available.
As the post suggested I attempted to override public int getRowHeight() but since the problem only affects hosted mode, I attempted to use a hook that applies just to hosted mode, and defers to the framework code in other cases so as to avoid affecting 'working' code... or so I thought.
however in fixing hosted mode, it causes script mode to break.
If I take the hook away, and return getCellHeight() regardless of the 'mode', it works.
If I have no overridden method, only script mode works.
I understand the fix in the thread did not specify to test for script/non-script, but can you explain why this doesn't work?
It's taken me several hours to figure out that this is actually causing a problem so I'm naturally eager to understand why.
I would expect the framework to be deferring to the superclass getRowHeight() method if I didn't have the override method in the code, so why doesn't it work when I put the hook in?
This simple demo class shows the problem:
I've checked builds up to 2014-06-30 but the hosted mode problem persists.
Can you indicate why functionality differs between hosted mode and script mode in this instance? And when a permanent fix will be made available?
Thanks.
I found this post that describes the symptoms we were seeing and a suggested workaround until a fix is available.
As the post suggested I attempted to override public int getRowHeight() but since the problem only affects hosted mode, I attempted to use a hook that applies just to hosted mode, and defers to the framework code in other cases so as to avoid affecting 'working' code... or so I thought.
Code:
@Override
public int getRowHeight(ListGridRecord record, int rowNum) {
if ( !GWT.isScript() ) {
return getCellHeight();
}
return super.getRowHeight(record, rowNum);
}
If I take the hook away, and return getCellHeight() regardless of the 'mode', it works.
Code:
@Override
public int getRowHeight(ListGridRecord record, int rowNum) {
return getCellHeight();
}
I understand the fix in the thread did not specify to test for script/non-script, but can you explain why this doesn't work?
It's taken me several hours to figure out that this is actually causing a problem so I'm naturally eager to understand why.
I would expect the framework to be deferring to the superclass getRowHeight() method if I didn't have the override method in the code, so why doesn't it work when I put the hook in?
This simple demo class shows the problem:
Code:
public class Test implements EntryPoint {
/**
* {@inheritDoc}
*/
@Override
public void onModuleLoad() {
SC.showConsole();
SC.say("Is script? " + GWT.isScript() );
final ListGrid grid = new ListGrid()
{
@Override
public int getRowHeight(ListGridRecord record, int rowNum) {
if ( !GWT.isScript() ) {
return getCellHeight();
}
return super.getRowHeight(record, rowNum);
}
};
ListGridField id = new ListGridField("identifier");
ListGridField description = new ListGridField("description");
description.setRequired(true);
grid.setFields(id, description);
grid.setWidth100();
grid.setHeight100();
IButton button = new IButton("click");
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
grid.startEditingNew();
}
});
VLayout canvas = new VLayout();
canvas.addMember(grid);
canvas.addMember(button);
canvas.show();
}
}
Can you indicate why functionality differs between hosted mode and script mode in this instance? And when a permanent fix will be made available?
Thanks.
Comment