The VirtualFlow is creating at least one extra cell (row) when you get at the very bottom of the TableView.
The thing is that the method "computeCurrentIndex()" can return a number equal to "getCellCount()". But the "cellCount" variable is equal to "getItems().size()". So if my cellCount is equal to 10, I should create cell with index going from 0 to 9. But it shouldn't create a cell with index set at 10.
What I suggest is to modify the two functions adding cells,first in "addLeadingCells()" in order to add that condition into the "while" loop:
if(index >= getCellCount()){
if (first) {
first = false;
}
--index;
}else{
//Do normal method
}
Then in "addTrailingCells()" by simply putting an extra condition into the "while" loop:
while (offset < viewportLength && index < getCellCount()) {
....
}
But the "addTrailingCells" takes a parameter called "fillEmptyCells". I don't know why it's here, and what it's supposed to do but adding extra cell that will receive no item can lead to strange behavior.
Problem may be linked with : https://javafx-jira.kenai.com/browse/RT-31252
The thing is that the method "computeCurrentIndex()" can return a number equal to "getCellCount()". But the "cellCount" variable is equal to "getItems().size()". So if my cellCount is equal to 10, I should create cell with index going from 0 to 9. But it shouldn't create a cell with index set at 10.
What I suggest is to modify the two functions adding cells,first in "addLeadingCells()" in order to add that condition into the "while" loop:
if(index >= getCellCount()){
if (first) {
first = false;
}
--index;
}else{
//Do normal method
}
Then in "addTrailingCells()" by simply putting an extra condition into the "while" loop:
while (offset < viewportLength && index < getCellCount()) {
....
}
But the "addTrailingCells" takes a parameter called "fillEmptyCells". I don't know why it's here, and what it's supposed to do but adding extra cell that will receive no item can lead to strange behavior.
Problem may be linked with : https://javafx-jira.kenai.com/browse/RT-31252