Question

I was trying to make my model strings to be always uppercase, so I tried to use converter and reverseConverter to do this job. Using the mutual option I got hitted by this topic.

Witch leads to my question. Is this the right use case to converter? Without the mutual the value was converted only in the model, and didn't update the view.

Can I use the DocumentFilter approach?

Example

 textField(columns: 3, text: bind("score", target: m, 
            converter: { it.isEmpty()? 0: Integer.parseInt(it) },
            reverseConverter: { String.valueOf(it) },
            mutual: true))
Was it helpful?

Solution

I'm afraid converter: and reverseConverter: only work with unidirectional bindings at the moment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top