Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComboBox with cellFormat does not show bound element #245

Closed
dominiks opened this issue Feb 2, 2017 · 2 comments
Closed

ComboBox with cellFormat does not show bound element #245

dominiks opened this issue Feb 2, 2017 · 2 comments

Comments

@dominiks
Copy link
Contributor

dominiks commented Feb 2, 2017

When adding a cellFormat to a combobox, the box will start with no value selected instead of the bound property. Removing the cellFormat shows it working as expected.

class ComboboxText : View() {
    val items = listOf("Item 1", "Item 2", "Item 3")
    val selectedItem = SimpleStringProperty("Item 1")

    override val root = borderpane {
        center {
            combobox(selectedItem, items) {
                cellFormat {
                    text = it
                }
            }
        }
    }
}

Note that this seems to only concern the visualization of the selected value. Setting the bound property via the combobox works.

@edvin
Copy link
Owner

edvin commented Feb 2, 2017

Thanks for reporting this. I have committed a fix now, you can build 1.6.2-SNAPSHOT to use it until release. If you'd rather work around the issue in the mean time, you can add the following code after the cellFormat block in your above example:

Platform.runLater {
    buttonCell = cellFactory.call(null)
}

@dominiks
Copy link
Contributor Author

dominiks commented Feb 2, 2017

Great, thanks for the super quick response!

@edvin edvin closed this as completed Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants