当前位置: 动力学知识库 > 问答 > 编程问答 >

GWT Datagrid throws an index out of bound exception when I try to update it with less than four rows

问题描述:

I am using a GWT Datagrid. I initially bind the grid with the filtered data. On click on a particular column of each row we can search for its related elements. Therefore I am updating the grid with the new data related to the clicked element using DataProvider. When the number of rows are less than four I am getting an index out of bound exception. The exception is a s follows:

java.lang.IndexOutOfBoundsException: toIndex = 54

at java.util.ArrayList.subListRangeCheck(ArrayList.java:922)

at java.util.ArrayList.subList(ArrayList.java:914)

at com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1370)

at com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1295)

at com.google.gwt.user.cellview.client.HasDataPresenter.access$3(HasDataPresenter.java:1062)

at com.google.gwt.user.cellview.client.HasDataPresenter$2.execute(HasDataPresenter.java:984)

at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)

at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:228)

at com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:327)

at com.google.gwt.core.client.impl.Impl.exit(Impl.java:266)

at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:257)

at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)

at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)

at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)

at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)

at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)

at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)

at java.lang.Thread.run(Thread.java:722)

Please help me with this problem.

网友答案:

John LaBanca wrote this

CellTable renders itself in a rendering loop, which means that you can make multiple synchronous changes to the range and/or data but only render once at the end of the synchronous changes. However, the table isn't designed to handle the case where user code actually modifies the table within the rendering loop.

The main things that can cause this are the following: Modifying the CellTable from within Cell#render() Overriding CellTable#renderRowValues() and modifying the CellTable from within it Trying to access an Element in CellTable from either of those methods Are you doing any of these? The code is somewhat complicated because its optimized for performance and has some special cases. Its certainly possible that there are subtle bugs.

http://comments.gmane.org/gmane.org.google.gwt/58531

分享给朋友:
您可能感兴趣的文章:
随机阅读: