Select row in Javafx Tableview

2019-02-25 11:00发布

enter image description here

According to my above Table view once I click on any Action icon it will navigate to another window (with selected data). How I keep selected same row when it back again to this Table view. Thanks.

标签: javafx-8
2条回答
男人必须洒脱
2楼-- · 2019-02-25 11:27

So sorry actually I have duplicated the question

Correct answer was there:

Platform.runLater(new Runnable()
{
    @Override
    public void run()
    {
        table.requestFocus();
        table.getSelectionModel().select(0);
        table.getFocusModel().focus(0);
    }
});
查看更多
闹够了就滚
3楼-- · 2019-02-25 11:35

Just remember the current selection (as a field) in your table view wrapper instance, and the restore it on re-focus.

查看更多
登录 后发表回答