【发布时间】:2016-01-26 22:49:50
【问题描述】:
我使用 MGWT 的 ScrollPanel 并执行以下操作:
private void scrollToBottom() {
if (getUiHandlers().isVisible()) {
final int height = scrollPanel.getOffsetHeight();
final int heightInt = cellList.getOffsetHeight();
final int y = scrollPanel.getMaxScrollY();
if (heightInt >= height) {
scrollPanel.scrollTo(0, y);
}
}
}
说到这一行:
scrollPanel.scrollTo(0, y)
我收到以下错误:
UncaughtException: (TypeError) : Cannot read property 'style' of undefined
UncaughtException details: setDelay_1_g$
UncaughtException details: setTransitionsDelay_0_g$
UncaughtException details: scrollbarPos_0_g$
UncaughtException details: pos_1_g$
UncaughtException details: execute_30_g$
UncaughtException details: startAnimation_0_g$
UncaughtException details: scrollTo_7_g$
UncaughtException details: scrollTo_6_g$
UncaughtException details: scrollTo_5_g$
UncaughtException details: scrollTo_3_g$
如何防止出现此错误?
【问题讨论】:
-
在将 ScrollPanel 添加到 DOM 之前是否调用了 scrollTo?查看我的更新答案stackoverflow.com/a/35016359/1417396
标签: javascript java html gwt mgwt