I have a classifications and a classification management screen, from a library system. After registering a new classification, I would like the TableView of classifications in the management screen to be updated showing the new record. I redo the query in the database and pass the values of the new query to the list, however it does not refresh on the screen. Here I call the method to redo the query after saving the information in the database:
{Rotina que salva a informação no banco}
GerenciarClassificacoesController controller = new GerenciarClassificacoesController();
controller.atualizarTableView();
Here is where it remaps the query and arrows the items in the TableView:
public class GerenciarClassificacoesController(){
@FXML
private void TableView<ClassificacaoLivro> tableClassificacoes;
...
public void atualizarTableView(){
itens = FXCollections.observableArrayList(servico.getClassificacoes());
tableClassificacoes.setItems(itens);
tableClassificacoes.refresh();
}
}
It falls into the TableView refresh method, it remaps the query in the database and brings up the right information, but it does not arrow in the TableView. Please help me: p NOTE: This same method (updateTableView) is called in the initialize of the screen, and works correctly, when I call from outside (another file) it does not work.