Hi All,
I am trying to delete a table row "on-action" using a checkbox from a dynamically created table. The problem I am having is that a callback is required when I adding the listener.
But because I am deleting the row on said action, and the the callback requires a return, it throws and out of bounds -1 exception. (* at least this is what i think is happening)
I found a workaround as long as I am not deleting the last available row in the table - but the exception occurs again on the last row.
Additionally I don't think its the correct way to use it.
This question is similar but unresolved:
https://coderanch.com/t/623984/java/Removing-selected-row-TableView
Below is the code where I'm adding the callback:
Error:
Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:418)
at java.util.ArrayList.get(ArrayList.java:431)
at com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:89)
at offlinepos.dairibord.DairibordSaleScreenController$40.call(DairibordSaleScreenController.java:1852)
at offlinepos.dairibord.DairibordSaleScreenController$40.call(DairibordSaleScreenController.java:1836)
at javafx.scene.control.cell.CheckBoxTableCell.getSelectedProperty(CheckBoxTableCell.java:391)
at javafx.scene.control.cell.CheckBoxTableCell.updateItem(CheckBoxTableCell.java:362)
at javafx.scene.control.TableCell.updateItem(TableCell.java:663)
at javafx.scene.control.TableCell.layoutChildren(TableCell.java:678)
An additional side effect to this is that when I try add the row again nothing appears on the screen -- even though my totals recalculate correctly.
So the information is there, but doesn't show onscreen. > .setVisible() does nothing to help with this.
I hope the above makes sense. Any ideas on what I could to do to resolve this?
Thanks!