I have a odata model that I want to bind to my table in my XML-view. The thing is, my data consists of objects, and these objects have 1 property that is an array. This array is what i want to show in my table.
I can't make it work, maybe because something like "ToWorkingDays/Data" isn't working with the table binding? Maybe you can help me. The metadata should be right.
My data: First the location and then the "ToWorkingDays" Data:
[{
"LocationID": 0,
"Title": "blabla",
"Subtitle": "subtitle",
"RandomNumber": "123"
}]
[{ "LocationID": 0,
"WorkingDaysID": 0,
"Data": [{
"Weekday": "Mon",
"WorkingTimeStart": "08:00",
"WorkingTimeEnd": "18:00",
"PauseTimeStart": "12:00",
"PauseTimeEnd": "13:00"
}, {
"Weekday": "Tue",
"WorkingTimeStart": "08:00",
"WorkingTimeEnd": "18:00",
"PauseTimeStart": "12:00",
"PauseTimeEnd": "13:00"
}] }]
My XML-view:
<Table items="{ToWorkingDays/Data}">
<columns>
<Column>
<Text text="Weekday"/>
</Column>
<Column>
<Text text="Work Time"/>
</Column>
<Column>
<Text text="Pause Time"/>
</Column>
<Column hAlign="End"/>
</columns>
<items>
<ColumnListItem>
<cells>
<ObjectIdentifier title="{Weekday}"/>
<Text text="{parts: [{path: 'WorkingTimeStart'}, {path: 'WorkingTimeEnd'}], formatter: '.getSpanValue'}"/>
<Text visible="{=${PauseTimeStart} !== undefined}"
text="{parts: [{path: 'jsonModel>PauseTimeStart'}, {path: 'PauseTimeEnd'}], formatter: '.getSpanValue'}"/>
<Button icon="sap-icon://edit" press="onEditPress"/>
</cells>
</ColumnListItem>
</items>
</Table>
My binding:
this.getView().bindElement({
parameters: {
expand: "ToWorkingDays"
},
path: "/" + sPath
});
My error:
List Binding is not bound against a list for /ToWorkinDays/Data
/ToWorkingDays
(meaning sPath in yourbindElement
isToWorkingDays
), you can just use/Days
in your items binding of the Table – Nitin