문제

I have a TableView (javafx.scene.control.TableView) which I populated with data. This data is retreived from the database as an ArrayList, so I used the folowing flow:

private ObservableList<Budget> budgetsObservable;
private ArrayList<Budget> budgetsArray;

I populate the ArrayList with budget data

budgetsArray= wrapper.findAllBudget();

I initialize the ObservableList with the data array

budgetsObservable = FXCollections.observableArrayList(budgetsArray);

To my TableView (TableView, I add my ObservableList

tableViewBudget.setItems(budgetsObservable);

I update the values in the array

budgetsArray = wrapper.UpdateBudget();

The initial data is shown correctly. I was expecting that by changing the ArrayList(last step), the ObservableList would see the change and pass it to my TableView. What would be the flow in order to make the change in the array result in the TableView being signalled and updated with the new data.

도움이 되었습니까?

해결책

Do

budgetsObservable.setAll(wrapper.updateBudget());
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top