背景:
假设我在一个视图中有单个表的多个片段,每个片段都有一个 rowExpander。
预期行为:
如果我在一个表片段中展开一行,其他片段相同的索引行应该被展开。崩溃也一样
我的进度:
示例片段:
tableview(dataset) {
column("First Name", Person::firstNameProperty)
column("Last Name", Person::lastNameProperty)
rowExpander(true) {
selectedData.item?.apply {
fire(ExpandDataEvent(dataset.indexOf(this)))
}
column("Mobile Nos.", Person::mobileNumProperty)
column("Email Ids", Person::emailIdProperty)
}
bindSelected(selectedData)
subscribe<ExpandDataEvent> { event ->
selectionModel.select(event.index)
}
}
活动类别:
class ExpandDataEvent(val index: Int) : FXEvent()
我从“订阅”中了解到的是,它在触发事件时被调用(目前,每当用户通过双击/单击加号扩展行时,我都会触发该事件);并且由于订阅放置在 tableview 中,因此会为所有存在的表片段调用它(这就是我想要的)。但是在 subscribe 方法中,我正在做一个 selectionModel.select(event.index) ,它只选择相应的索引行。我想扩展行(最好使用 selectionModel)
问题2:
是否可以删除加号列?对于rowExpand,如果我将expandOnDoubleClick 设置为true,我不想在我的tableview 中添加加号列。