Kotlin 设置格式时,单元格值不再可编辑
当我使用此处定义的Kotlin 设置格式时,单元格值不再可编辑,kotlin,tornadofx,Kotlin,Tornadofx,当我使用此处定义的cellFormat功能时 表中的“我的单元格”停止显示其值,并且不可编辑。 我的桌子看起来像: with(tradeTable) { enableCellEditing() columnResizePolicy = SmartResize.POLICY isEditable = true column("Id", TradeEntity::id)
cellFormat
功能时
表中的“我的单元格”停止显示其值,并且不可编辑。
我的桌子看起来像:
with(tradeTable)
{
enableCellEditing()
columnResizePolicy = SmartResize.POLICY
isEditable = true
column("Id", TradeEntity::id)
column("Issue Date", TradeEntity::issueDate).makeEditable().cellFormat {
style {
// if (it.dayOfMonth - LocalDate.now().dayOfMonth<=2 ) {
// backgroundColor+=c("#FFA500")
// textFill = Color.WHITE
// }
}
} ... more columns...
with(贸易表)
{
enableCellEditing()
columnResizePolicy=SmartResize.POLICY
isEditable=true
列(“Id”,TradeEntity::Id)
列(“发布日期”,TradeEntity::issueDate).makeEditable().cellFormat{
风格{
//如果(it.dayOfMonth-LocalDate.now().dayOfMonth我见过的所有示例都明确指定了cellFormat
中的text
属性,因此您应该将代码修改为:
column("Issue Date", TradeEntity::issueDate).makeEditable().cellFormat {
style {
// whatever
}
text = it.toString() //possible transformations?
}
cellFormat
要求您指定单元格的text
或graphic
属性,否则不会显示任何内容。由于cellFormat
安装了自己的CellFactory
,因此它与makeEditable()
直接竞争。如果您调用makeEditable())
但是,您可以使用cellDecorator
而不是cellFormat
来进一步自定义单元格。谢谢,这有助于显示值,但无法使其可编辑