Checkbox selected bind with TableView

后端 未结 1 550
星月不相逢
星月不相逢 2021-01-15 16:02

How to bind with TableView selection model \"enterwith checkbox isSelected in table view.In ma

1条回答
  •  遥遥无期
    2021-01-15 16:23

    Add to this line in box.selectedProperty().addListener()

    tableView.getSelectionModel().select(getTableRow().getIndex());

    box.selectedProperty().addListener(new ChangeListener() {
        @Override
        public void changed(ObservableValue ov, Boolean t, Boolean t1) {
            if (t1) {
                tableView.getSelectionModel().select(getTableRow().getIndex());
    
            } else {
                tableView.getSelectionModel().clearSelection(getTableRow().getIndex());
            }
        }
    });
    

    0 讨论(0)
提交回复
热议问题