java.lang.UnsupportedOperationException for removing a row from the javafx tableview

后端 未结 2 524
广开言路
广开言路 2021-01-21 19:06

I am trying to delete the selected record from the tableview in javafx. Below is how I am populating the table with the data:

public void setMainApp(MainAppClass         


        
2条回答
  •  花落未央
    2021-01-21 19:44

    Remove the data from the underlying list, not the filtered/sorted list:

    FileModel selectedItem = fileTable.getSelectionModel().getSelectedItem();
    if (selectedItem != null) {
        mainApp.getFileData().remove(selectedItem);
    }
    

提交回复
热议问题