makeeditable doesnt work when setting cellFormat

时间:2018-02-26 19:23:17

标签: javafx kotlin tornadofx

I have a table as follows:

with(myTable)
{
    enableCellEditing()
    columnResizePolicy = SmartResize.POLICY
    isEditable = true
    column("Issue Date", TradeEntity::issueDate).makeEditable().cellFormat { tc ->
        style { if (tc.dayOfMonth==10) backgroundColor += Color.ORANGE }
        text = tc.toString()
    }

I cannot make this editable AND having a style. It's either I have a style, either it's editable... Any help?

EDIT Solved, at least in Java, I guess it's all because I didn't call super.updateItem(it,empty) in Kotlin

1 个答案:

答案 0 :(得分:2)

当您致电cellFormat时,

CellFactory会替换已安装的makeEditable(),因此他们会互相直接竞争。出于这个原因,TornadoFX提供了cellDecorator,它保留了现有的CellFactory

column("First Name", Customer::firstNameProperty) {
    makeEditable()
    cellDecorator {
        style {
            fontWeight = FontWeight.BOLD
        }
    }
}
相关问题