SAPUI5 | OPENUI5模型绑定不起作用

时间:2018-03-07 08:19:03

标签: data-binding binding sapui5 model-binding

我有一个vertical layout,其中input fields可能<Input/>, <DatePicker/>, <Checkbox/><DateTimePicker/>value。当我将Input, DateTimePicker or DatePicker的{​​{1}}绑定到"{thingDetail>value}"时,它就像应该的那样工作。当我尝试将selected中的checkbox部分绑定到"{thingDetail>value}"时,始终会检查checkbox,即使我的JSONModel表示值为{{1} }}

"false"

当我记录它时,这是我的 <layout:VerticalLayout width="100%" visible="{= ! ${path: 'thingDetail>properties'}}"> <Input id="masterDataValueInput" value="{thingDetail>value}" placeholder="{path:'thingDetail>type', formatter:'.formatter.placeHolderFormatter'}" visible="{= ${path: 'thingDetail>type', formatter: '.formatter.inputVisibility'}}" enabled="{appView>/isCurrentTenant}" width="100%" type="{path:'thingDetail>type', formatter:'.formatter.inputTypeFormatter'}"/> <DatePicker id="masterDataValueDate" value="{thingDetail>value}" visible="{= ${path: 'thingDetail>type', formatter: '.formatter.dateVisibility'}}" enabled="{appView>/isCurrentTenant}" width="100%"/> <DateTimePicker id="masterDataValueDateTime" value="{thingDetail>value}" visible="{= ${path: 'thingDetail>type', formatter: '.formatter.datetimeVisibility'}}" enabled="{appView>/isCurrentTenant}" width="100%"/> <CheckBox id="masterDataValueCheckbox" selected="{thingDetail>value}" visible="{= ${path: 'thingDetail>type', formatter: '.formatter.checkboxVisibility'}}" enabled="{appView>/isCurrentTenant}"/> </layout:VerticalLayout> This is my Model

我的JSONModel看起来像这样: view 知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

TwoWayDataBinding无法实现Nervermind .. formatter。错误是data type

使用以下代码:

                            <CheckBox
                                id="masterDataValueCheckbox" 
                                selected="{path: 'thingDetail>value', type: 'sap.ui.model.type.String'}"
                                visible="{= ${path: 'thingDetail>type', formatter: '.formatter.checkboxVisibility'}}" 
                                enabled="{appView>/isCurrentTenant}"/>