We are using JSON views in openUI5 in the sapUI5 explored demo they use this xml view for their grouped list
<mvc:View
controllerName="sap.m.sample.ListGrouping.List"
xmlns:l="sap.ui.layout"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m">
<List
items="{
path: '/ProductCollection',
sorter: {
path: 'SupplierName',
descending: false,
group: true
},
groupHeaderFactory: '.getGroupHeader'
}"
headerText="Products" >
<StandardListItem
title="{Name}"
description="{ProductId}"
icon="{ProductPicUrl}"
iconDensityAware="false"
iconInset="false" />
</List>
</mvc:View>
We translated it to this json view but the sorter and the header factory is ignored. The items are displayed as expected
{
"Type": "sap.ui.core.mvc.JSONView",
"controllerName": "company.controller.XY",
"content": [
{
"Type" : "sap.m.List",
"height" : "100%",
"items" : {
"path" : "/ProductCollection",
"sorter" : {
"path" : "SupplierName",
"descending" : false,
"group" : true
},
"groupHeaderFactory" : ".getGroupHeader",
"template" : {
"Type" : "sap.m.StandardListItem",
"title" : "{Name}",
"description" : "{ProductId}",
"icon" : "{ProductPicUrl}",
"iconDensityAware" : false,
"iconInset" : false
}
}
}
]
}
How to transform the xml view to a json view? Is there any tool out there which is doing this automaticly?
I just reported your issue on github.
According to SAP-Developers this is a recognized JSON-View Bug.
...the JSONView currently doesn't properly resolve controller methods. This is a known gap in the JSONView, which unfortunately still hasn't been closed although it was detected already back in June (JSONViews are not used that much...).
The only choice you have is to create a sap.m.List.items
-Binding in your Controller via Javascript or switch your View declaration to either Javascript- or XML-Views.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With