سؤال

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))
هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top