由于CAP CDS已经通过注解定义了前端的通用表示内容,因此一旦指定了Odata V4数据源,LROP智能模板就会正确地呈现相应的内容,例如list report和object page。
App对象页头由CAP CDS生成,其他元素如simulate price按钮、approved按钮、document table等由App Extensions生成。对象页面概述如下所示:以下内容是object page预览以及具体的实现细节。

object page overview
"extends": {
"extensions": {
"sap.ui.controllerExtensions": {
"sap.fe.templates.ListReport.ListReportController": {
"controllerName": "deviation-price.ext.controller.ListReportExt"
},
"sap.fe.templates.ObjectPage.ObjectPageController": {
"controllerName": "deviation-price.ext.controller.ObjectPageExt"
}
}
}
} "routing": {
"config": {},
"routes": [
{
"pattern": ":?query:",
"name": "DeviationItemsByPriceList",
"target": "DeviationItemsByPriceList"
},
{
"pattern": "DeviationItemsByPriceListNew({key}):?query:",
"name": "DeviationItemsByPriceObjectPage",
"target": "DeviationItemsByPriceObjectPage"
}
],
"targets": {
"DeviationItemsByPriceObjectPage": {
"type": "Component",
"id": "DeviationItemsByPriceObjectPage",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings": {
"entitySet": "DeviationItemsByPriceListNew",
"editableHeaderContent": false,
"content": {
"header": {
"actions": {
"simulatePriceAction": {
"press": "deviation-price.ext.controller.simulatePriceAction.simulatePrice",
"enabled": true,
"text": "{i18n>simulatePriceButtonText}"
}
}
}
}
}
}
}
}
}"routing": {
"config": {},
"routes": [
{
"pattern": ":?query:",
"name": "DeviationItemsByPriceList",
"target": "DeviationItemsByPriceList"
},
{
"pattern": "DeviationItemsByPriceListNew({key}):?query:",
"name": "DeviationItemsByPriceObjectPage",
"target": "DeviationItemsByPriceObjectPage"
}
],
"targets": {
"DeviationItemsByPriceObjectPage": {
"type": "Component",
"id": "DeviationItemsByPriceObjectPage",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings": {
"entitySet": "DeviationItemsByPriceListNew",
"editableHeaderContent": false,
"content": {
"body": {
"sections": {
"documentsTableWithCount": {
"type": "XMLFragment",
"template": "deviation-price.ext.fragment.ObjectPageInfo"
}
}
}
}
}
}
}
}
}<core:FragmentDefinition
xmlns:core="sap.ui.core"
xmlns:l="sap.ui.layout"
xmlns="sap.ui.table"
xmlns:mvc="sap.ui.core.mvc"
xmlns:m="sap.m"
xmlns:u="sap.ui.unified"
>
<TreeTable
id="persoTable"
core:require="{handler: 'deviation-price/ext/controller/ObjectPageInfo'}"
rows="{path:'testModel>/', parameters: {arrayNames:['selfBillingDocumentItemList']}}"
selectionMode="MultiToggle"
enableSelectAll="true"
selectionBehavior="RowSelector"
rowSelectionChange='handler.rowSelectionChangeFun'
ariaLabelledBy="title">
<extension>
<m:OverflowToolbar style="Clear">
<m:Title id="title" text="{i18n>documents}"/>
<m:ToolbarSpacer/>
<m:Button id='approveButton' text="{i18n>approve}" press="handler.onApprove" enabled='false'/>
</m:OverflowToolbar>
</extension>
<columns>
</columns>
</TreeTable>
</core:FragmentDefinition>let approvedId = this.byId(
'deviation-price::DeviationItemsByPriceObjectPage--fe::HeaderFacetContainer::approved');
let approvedIdContext = approvedId.getBindingContext();
if (!approvedIdContext.hasPendingChanges()) {
approvedIdContext.refresh();
}You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 47 | |
| 38 | |
| 37 | |
| 30 | |
| 30 | |
| 28 | |
| 26 | |
| 26 | |
| 25 | |
| 25 |