且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JavaFX:基于其他TableView在TableView中禁用多行

更新时间:2023-12-04 13:10:10

我不太确定你想要的逻辑,但如果您的行工厂附加到表1,并且当表2中存在该项时您正在禁用该行,执行:

I'm not quite sure of the logic you're wanting, but if your row factory is attached to table 1, and you are disabling the row when the item is present in table 2, do:

row.disableProperty().bind(Bindings.createBooleanBinding(() -> 
    table2.getItems().contains(row.getItem()), table2.getItems(), row.itemProperty()));