gpt4 book ai didi

javascript - MGWT ScrollPanel.scrollTo(0, y) 导致无法读取未定义的属性 'style'

转载 作者:行者123 更新时间:2023-11-30 16:19:11 26 4
gpt4 key购买 nike

我使用 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$

我怎样才能避免这个错误?

最佳答案

从源代码和堆栈跟踪来看,您似乎遇到了滚动条问题。当您调用 scrollTo 时,您的 mgwt 滚动面板是否总是有滚动条?

此外,我强烈建议您将 scrollPanel.scrollTo(0, y); 调用包装到 Scheduler.get().scheduleDeffered(..your scrollTo call here在此处输入代码..)

关于javascript - MGWT ScrollPanel.scrollTo(0, y) 导致无法读取未定义的属性 'style',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35010681/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com