if (firstvisible != lastRequestedFirstvisible && scrollBody != null) {
// received 'surprising' firstvisible from server: scroll there
firstRowInViewPort = firstvisible;
- bodyContainer.setScrollPosition(firstvisible
- * scrollBody.getRowHeight());
+ bodyContainer.setScrollPosition((int) (firstvisible * scrollBody
+ .getRowHeight()));
}
showRowHeaders = uidl.getBooleanAttribute("rowheaders");
// int bodyHeight = scrollBody.getOffsetHeight();
bodyHeight = scrollBody.getRequiredHeight();
} else {
- bodyHeight = (scrollBody.getRowHeight(true) * pageLength);
+ bodyHeight = (int) Math.ceil(scrollBody.getRowHeight(true)
+ * pageLength);
}
boolean needsSpaceForHorizontalSrollbar = (total > availW);
if (needsSpaceForHorizontalSrollbar) {
// without
DeferredCommand.addCommand(new Command() {
public void execute() {
- bodyContainer.setScrollPosition(firstvisible
- * scrollBody.getRowHeight());
+ bodyContainer
+ .setScrollPosition((int) (firstvisible * scrollBody
+ .getRowHeight()));
firstRowInViewPort = firstvisible;
}
});
return true;
}
} else {
- int fakeheight = scrollBody.getRowHeight() * totalRows;
+ int fakeheight = (int) Math.ceil(scrollBody.getRowHeight()
+ * totalRows);
int availableHeight = bodyContainer.getElement().getPropertyInt(
"clientHeight");
if (fakeheight > availableHeight) {
public static final int DEFAULT_ROW_HEIGHT = 24;
- private int rowHeight = -1;
+ private double rowHeight = -1;
private final List<Widget> renderedRows = new ArrayList<Widget>();
if (lastRendered < reactLastRow) {
// get some cache rows below visible area
rowRequestHandler.setReqFirstRow(lastRendered + 1);
- rowRequestHandler.setReqRows(reactLastRow - lastRendered - 1);
+ rowRequestHandler.setReqRows(reactLastRow - lastRendered);
rowRequestHandler.deferRowFetch(1);
} else if (scrollBody.getFirstRendered() > reactFirstRow) {
/*
}
private void fixSpacers() {
- int prepx = getRowHeight() * firstRendered;
+ int prepx = (int) Math.round(getRowHeight() * firstRendered);
if (prepx < 0) {
prepx = 0;
}
- DOM.setStyleAttribute(preSpacer, "height", prepx + "px");
- int postpx = getRowHeight() * (totalRows - 1 - lastRendered);
+ preSpacer.getStyle().setPropertyPx("height", prepx);
+ int postpx = (int) (getRowHeight() * (totalRows - 1 - lastRendered));
if (postpx < 0) {
postpx = 0;
}
- DOM.setStyleAttribute(postSpacer, "height", postpx + "px");
+ postSpacer.getStyle().setPropertyPx("height", postpx);
}
- public int getRowHeight() {
+ public double getRowHeight() {
return getRowHeight(false);
}
- public int getRowHeight(boolean forceUpdate) {
+ public double getRowHeight(boolean forceUpdate) {
if (tBodyMeasurementsDone && !forceUpdate) {
return rowHeight;
} else {
if (tBodyElement.getRows().getLength() > 0) {
int tableHeight = getTableHeight();
int rowCount = tBodyElement.getRows().getLength();
- rowHeight = tableHeight / rowCount;
+ rowHeight = tableHeight / (double) rowCount;
} else {
if (isAttached()) {
// measure row height by adding a dummy row
return new RenderSpace(w, 0) {
@Override
public int getHeight() {
- return getRowHeight();
+ return (int) getRowHeight();
}
};
}
return;
}
- int rowHeight = scrollBody.getRowHeight();
+ int rowHeight = (int) scrollBody.getRowHeight();
int bodyH = bodyContainer.getOffsetHeight();
int rowsAtOnce = bodyH / rowHeight;
boolean anotherPartlyVisible = ((bodyH % rowHeight) != 0);
if (visible) {
DeferredCommand.addCommand(new Command() {
public void execute() {
- bodyContainer.setScrollPosition(firstRowInViewPort
- * scrollBody.getRowHeight());
+ bodyContainer
+ .setScrollPosition((int) (firstRowInViewPort * scrollBody
+ .getRowHeight()));
}
});
}
return;
}
if (!enabled) {
- bodyContainer.setScrollPosition(firstRowInViewPort
- * scrollBody.getRowHeight());
+ bodyContainer
+ .setScrollPosition((int) (firstRowInViewPort * scrollBody
+ .getRowHeight()));
return;
}
tHead.setHorizontalScrollPosition(scrollLeft);
firstRowInViewPort = (int) Math.ceil(scrollTop
- / (double) scrollBody.getRowHeight());
+ / scrollBody.getRowHeight());
if (firstRowInViewPort > totalRows - pageLength) {
firstRowInViewPort = totalRows - pageLength;
}