我正在尝试使用JSON模型中嵌套数组中的数据进行聚合绑定:这是我的模特:
{
"days": [{
"day": "monday",
"menus": [{
"menu": "Spaghetti mit Rinder-Bolognese oder VEGATARISCH mit TomatenBasilikumsoße und Parmesan",
"price": "3.90",
"price2": "2.90",
"title": "Menü 1"
}, {
"menu": "Schweinerückensteak frisch aus der Pfanne Maisgemüse mit Ofenpaprika und Blattpetersilie Kartoffel Gnocchi im Kürbissud grüne Pfeffer-Butter mit Basilikum",
"price": "4.40",
"price2": "3.40",
"title": "Menü 2"
}, {
"menu": "Tilapia aus dem Ofen mit Kokos-Zitronengras Sauce 2,70 € Chinakohl, Karotten, Champignons und Erbsen Jasmin Duftreis",
"price": "4.80",
"price2": "3.50",
"title": "Live Cooking"
}, {
"menu": "VEGETARISCH Kokos Paprikasuppe",
"price": "1.20",
"price2": "Suppenschale: 3.50",
"title": "Suppe"
}, {
"menu": "Blumenkohl-Lauch Bratling mit Soja-Kerbeldip",
"price": "2.50",
"price2": "",
"title": "Veganer Bratling"
}]
}, {
"day": "tuesday",
"menus": [{...}]
}, {
"day": "wednesday",
"menus": [{...}]
}, {
"day": "Donnerstag",
"menus": [{...}]
}, {
"day": "Freitag",
"menus": [{...}]
}]}
我想像这样将“星期一”绑定到我的桌子上
<Table id="nordMenuTable" inset="false" items="{ path: '/Menus>/monday/menu' }">
<columns>
<Column minScreenWidth="Phone" demandPopin="true"/>
<Column minScreenWidth="Desktop" demandPopin="true" popinDisplay="WithoutHeader"><ObjectIdentifier title="{i18n>NordColumn1}"/></Column>
<Column minScreenWidth="Desktop" demandPopin="true" popinDisplay="Inline"><ObjectIdentifier title="{i18n>NordColumn3}"/></Column>
<Column minScreenWidth="Phone" hAlign="End"><ObjectIdentifier title="{i18n>NordColumn2}"/></Column>
</columns>
<items>
<ColumnListItem>
<ObjectIdentifier title="{Menus/>title}"/>
<Text text="{Menus>/menu}"/>
<Text text="{Menus>/price2}"/>
<Text text="{Menus>/price}"/>
</ColumnListItem>
</items>
</Table>
[请为我提供带有嵌套数组的JSON文件的绑定语法。我知道,如果我只有一个JSON模型,并且其中的数据仅位于嵌套数组中,那么一切都会起作用,但是我需要这样的JSON文件以及与特定日期相关的所有菜单。
您的json模型应该类似于:
{
"days": {
"monday": {
"menus": [{
}]
},
"tuesday": {
"menus": [{
}]
}
}
}
并且您的items
汇总应为items="{ path: '/Menus>/monday/menus' }"