Aaron Shen
Aaron Shen

Reputation: 8374

Why after set formatter of a property binding of TextField, the json model binding becomes "oneway"?

I'm writing an application using XML view. There is a JSON Model 'data' set on the view, when I put a text field like below, I can get the updated value from user input.

<TextField value="{path: 'data>/xxx'}" />

But if I put a formatter in the binding like below, then it's impossible to get the updated value back.

<TextField value="{path: 'data>/xxx',
                   formatter: 'abc.util.formatter.yyy'}" />

Why is that? How to use JSONModel TwoWay binding and formatter at the same time???

Upvotes: 2

Views: 2373

Answers (2)

matbtt
matbtt

Reputation: 4231

The binding mode switches to OneWay as formatters do not support bi-directional data flow, as they are used for formatting property values for the output. A TwoWay binding includes also parsing and validating input before it is written to the model. If you need this, you should use a type instead. This is the same for all model type, not only the JSONModel.

Upvotes: 7

Emre
Emre

Reputation: 153

Maybe your binding sytle is problem. Can you try this in your index.

data-sap-ui-xx-bindingSyntax="complex"

Upvotes: -1

Related Questions