如何为sap.ui.layout.ResponsiveSplitter配置路由器?

时间:2018-08-21 06:46:51

标签: sapui5

相关:

What is the meaning of 'controlAggregation' in the SAPUI5 routing configuration?

Routing Configuration Documentation

ResponsiveSplitter sample

我的配置:

// App.view.xml
<l:ResponsiveSplitter>
  <l:PaneContainer id="idAppControl">
  </l:PaneContainer>
</l:ResponsiveSplitter>

// Master/Detail.view.xml
<l:SplitPane>
    <Panel headerText="some text"></Panel>
</l:SplitPane>

// manifest.json
"routing": {
  "config": {
    "routerClass": "sap.m.routing.Router",
    "viewType": "XML",
    "viewPath": "mynamespace.view",
    "controlId": "idAppControl",
    "bypassed": {
      "target": [
        "master",
        "notFound"
      ]
    },
    "async": true
  },
  "routes": [
    {
      "pattern": "/:?query:",
      "name": "master",
      "target": [
        "master"
      ]
    },
    {
      "pattern": "ControlSet/{objectId}",
      "name": "entity",
      "target": [
        "master",
        "object"
      ]
    }
  ],
  "targets": {
    "master": {
      "viewName": "Master",
      "viewId": "master",
      "controlAggregation": "panes"
    },
    "object": {
      "viewName": "Detail",
      "viewId": "detail",
      "controlAggregation": "panes"
    },
    "notFound": {
      "viewName": "NotFound",
      "viewId": "notFound",
      "controlAggregation": "panes"
    }
  }
}

ResponsiveSplitter的聚合关系为:

  

ResponsiveSplitter-> rootPaneContainer(Aggregations)-> PaneContainer->窗格(Aggregations)-> SplitPane

ResponsiveSplitter-> PaneContainer(一对一关系)

PaneContainer-> SplitPane(一对多关系)

但是我得到一个错误:

  

错误:“ Element sap.ui.layout.SplitPane #__ pane0”对于Element sap.ui.core.mvc.XMLView#application-Monitor-display-component --- master 的聚合“内容”无效>

1 个答案:

答案 0 :(得分:0)

由于@Erch的建议,我改用FlexibleColumnLayout,路由配置:

"routing": {
  "config": {
    "routerClass": "sap.f.routing.Router",
    "viewType": "XML",
    "viewPath": "monitor.view",
    "controlId": "fcl",
    "transition": "slide",
    "bypassed": {
    },
    "async": true
  },
  "routes": [
    {
      "pattern": ":layout:",
      "name": "master",
      "target": [
        "master",
        "detail"
      ]
    },
    {
      "pattern": "detail/{objectId}/{layout}",
      "name": "detail",
      "target": [
        "master",
        "detail"
      ]
    }
  ],
  "targets": {
    "master": {
      "viewName": "Master",
      "controlAggregation": "beginColumnPages"
    },
    "detail": {
      "viewName": "Detail",
      "controlAggregation": "midColumnPages"
    }
  }
}