SmartClient Version: v12.0p_2019-05-14/LGPL Development Only (built 2019-05-14)
Chrome Version 74.0.3729.157 (Official Build) (64-bit)
When a ListGrid has setAutoFitData(Autofit.VERTICAL), and there is only 1 record, it renders oddly with the outer border extending beyond the grid body:

I tracked this down to _getDefaultMinHeight in ISC_Grids.js on line 21112:
Specifically, _getEmptyMessageStyleVPad adds 22 pixels (for Enterprise skin) of height even when cellHeight would be sufficient to contain the empty message.
Fortunately, there's an easy work-around: setShowEmptyMessage(false):

FWIW, the previous version of smartgwt we were using, 5.0p from 2015-01-14, did not have this glitch.
Maybe this could be fixed by using the greater of (_getEmptyMessageStyleVPad()+space for the text) or cellHeight instead of the sum?
Anyway, not a big deal since there's an easy work-around, but I figured I'd report it.
Example code:
Chrome Version 74.0.3729.157 (Official Build) (64-bit)
When a ListGrid has setAutoFitData(Autofit.VERTICAL), and there is only 1 record, it renders oddly with the outer border extending beyond the grid body:
I tracked this down to _getDefaultMinHeight in ISC_Grids.js on line 21112:
Code:
_getDefaultMinHeight : function () {
var minHeight = this.cellHeight + this.getVMarginBorderPad();
if (this.showHeader) minHeight += this.headerHeight;
if (this.showFilterEditor) minHeight += this.filterEditorHeight;
if (this.showEmptyMessage) minHeight += this._getEmptyMessageStyleVPad();
if (this.showGridSummary) minHeight += this.summaryRowHeight;
return minHeight;
},
Fortunately, there's an easy work-around: setShowEmptyMessage(false):
FWIW, the previous version of smartgwt we were using, 5.0p from 2015-01-14, did not have this glitch.
Maybe this could be fixed by using the greater of (_getEmptyMessageStyleVPad()+space for the text) or cellHeight instead of the sum?
Anyway, not a big deal since there's an easy work-around, but I figured I'd report it.
Example code:
Code:
public class AutoFitDataTestWindow extends Window
{
AutoFitDataTestWindow()
{
setAutoSize(true);
final VLayout layout = new VLayout()
{{
setWidth(500);
setHeight(500);
setMargin(30);
setBackgroundColor("#99CCFF");
final ListGrid testGrid = new ListGrid()
{{
setWidth(300);
setHeight(69);
// setShowEmptyMessage(false); uncomment to fix display
setAutoFitData(Autofit.VERTICAL);
final ListGridField inspectionPoint = new ListGridField("inspectionPoint", "Inspection Point");
final ListGridField defects = new ListGridField("defects", "Defects");
setFields(inspectionPoint, defects);
setData(createTestData(1));
addDrawHandler(drawEvent -> setAutoHeight());
}};
setMembers(testGrid);
}};
addItem(layout);
}
private static ListGridRecord[] createTestData(int n)
{
final Supplier<ListGridRecord> s = () -> new ListGridRecord()
{{
setAttribute("inspectionPoint", "test inspectionPoint");
setAttribute("defects", "test defects");
}};
return Stream.generate(s).limit(n).toArray(ListGridRecord[]::new);
}
}
Comment