Checkbox selected bind with TableView

后端 未结 1 549
星月不相逢
星月不相逢 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<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
            if (t1) {
                tableView.getSelectionModel().select(getTableRow().getIndex());
    
            } else {
                tableView.getSelectionModel().clearSelection(getTableRow().getIndex());
            }
        }
    });
    
    0 讨论(0)
提交回复
热议问题