Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Grid - uncaught client side IllegalArgumentException with Row index (-1)
through the ?debug facility I found out that my application is throwing a weird IllegalArgumentException (see attachment).
The application has three grids, one of which is dedicated to displaying log messages and this is the responsible one of the exception.
I manage all the grids the same way, but the other two are absolutely fine, while this one is giving me problems.
What I found out is that this execption is thrown only when the grid is empty. If there are items within, the exception is not thrown. If I clean the content of the grid the message comes up again.
The log grid is apparently working fine, but from time to time I see empty lines which get refreshed when I click on them.
I tried to do everything possible, but I can't get rid of this problem.
What surprises me of the exception is actually the negative row index. I am not inserting the items within the grid manually, but I rather use a BeanItemContainer to which I associate a log buffer which gets upcoming log messages from a log appender, therefore I do not understand how can the grid's row index get negative.
Has anybody ever seen this error before or has any idea on where the actual cause might be located?
Thanks in advance for any support
What Vaadin version do you use?
Your grid sympthoms look similar to bugs fixed in grid at some point.
Also try to clean a grid selection when you clean grid content.
In fact the version of Vaadin I am currently using is 7.6.3 which is the latest at this time, but I am having this problem since I made this logging facility, when I was using version 7.6.0.
Concerning the grid selection, I am actually using SelectionMode.NONE, does it still make sense to clear the selection in this case?
Ok, I maybe figured out the actual reason of the issue.
Within the code I use the scrollToEnd() method to get to the end of the grid whenever a new item is inserted in the related container. If I comment this call out, the IllegalArgumentException seems not to be thrown.
I understand that this exception maybe occurs because the grid is empty, but is it the intended behaviour?
Shouldn't a call to scrollToEnd() just be without any effect if the grid is empty, instead of throwing an exception?
The exception thrown and the provided reason (Row index (-1)) let me actually think that this might be a bug, but I might be wrong.