Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

TableView#useCheckBox() not binding #247

Closed
andrzejtokarski opened this issue Feb 10, 2017 · 4 comments
Closed

TableView#useCheckBox() not binding #247

andrzejtokarski opened this issue Feb 10, 2017 · 4 comments

Comments

@andrzejtokarski
Copy link

GitHub does not let me to reopen the issue so here is a new one.

To replicate:

import tornadofx.*

class CheckBoxTest : App(CheckBoxTestWindow::class)

class CheckBoxTestWindow: View() {

    class SomeViewModel(id: String, ignore: Boolean) {
        var id by property(id)
        var ignore by property(ignore)
    }

    val elements = (0..100).map { SomeViewModel(it.toString(), ignore = false) }.toMutableList().observable()

    override val root = tableview(elements) {
        column("Id", SomeViewModel::id)
        column("Ignore", SomeViewModel::ignore).useCheckbox(editable = true)
    }
}

Check some of the boxes then scroll away and back. Those boxes are back to false.

@andrzejtokarski
Copy link
Author

My fault. The view model should include:
fun ignoreProperty() = getProperty(SomeViewModel::ignore)

and column definition:
column("Ignore", SomeViewModel::ignoreProperty).useCheckbox(editable = true)

as mentioned in the documentation:
https://edvin.gitbooks.io/tornadofx-guide/content/5.%20Data%20Controls.html

edvin pushed a commit that referenced this issue Feb 10, 2017
… when constructor params with same name is present (#247)
@edvin
Copy link
Owner

edvin commented Feb 10, 2017

Actually, there is no reason why we shouldn't support your initial code as well. I've improved the targeting for mutable columns, so the code example above should now work out of the box with 1.6.2-SNAPSHOT. Thanks for reporting this :)

@andrzejtokarski
Copy link
Author

This is why this project is amazing. If only Oracle cared half this much...

@edvin
Copy link
Owner

edvin commented Feb 10, 2017

Let's hope it picks up steam after JDK 9 is out. I think a lot of work went into adapting for Jigsaw, even if it produced minimal features or improvements.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants