I have a vertical layout
with 4 possible input fields
like <Input/>, <DatePicker/>, <Checkbox/>
and <DateTimePicker/>
. When I bind the value
of Input, DateTimePicker or DatePicker
to "{thingDetail>value}"
it works like it should. When I try to bind the selected
part in my checkbox
to "{thingDetail>value}"
the checkbox
is always checked, even if my JSONModel
says the value is "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>
Nervermind.. TwoWayDataBinding
isn't possible with a formatter
. The mistake was the data type
.
With the following code it works:
<CheckBox
id="masterDataValueCheckbox"
selected="{path: 'thingDetail>value', type: 'sap.ui.model.type.String'}"
visible="{= ${path: 'thingDetail>type', formatter: '.formatter.checkboxVisibility'}}"
enabled="{appView>/isCurrentTenant}"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.