<@U0HUJ25V1> I've used this same convention in the...
# tornadofx
e
@thomasnield I've used this same convention in the validation decorators for forms, and I think it works pretty well. I've seen similar things in ExtJS and probably some other frameworks, so I feel it conveys dirty state pretty well. I've committed an initial version of the edit model, so you can try it out. All you need to do is call
table.enableDirtyTracking()
and the dirty columns should light up. To commit a row, do
table.editModel.commit(item)
or
table.editModel.commitSelected()
. Same for
rollback
of course. You can get to the dirty state for an item by doing
table.editModel.getDirtyState(item)
. On this object you can get the dirty columns via the
dirtyColumns
map. The keys are the columns and the values are the initial value of that column for the given item (that's the value used to do rollback). Remember that commit just clears the dirty state really, the values are written into your domain objects as you edit them, but rollback can revert that. I recommend also enabeling
regainFocusAfterEdit()
and
enableCellEditing()
on the TableView for a more pleasant editing experience. Also take a look at https://github.com/edvin/tornadofx/blob/master/src/test/kotlin/tornadofx/testapps/TableViewDirtyTest.kt for some advanced usage, including rolling back for columns, context menu and some default button actions. Let me know how this goes and if something is unclear. Tonight I'll first try to finish the docs for the Workspace, then write the docs for this feature and finally create a screencast to show this feature.