2017-06-29 58 views
0

我有一个小测试应用程序(刚入门),我想根据我所在的应用程序的哪个区域更改工具栏。此刻,我正在使用工具栏控件。当目标将视图实例化到工具栏中时,多个工具栏同时可见。在OpenUI5中,我如何获得加载新工具栏的目标,但是擦除了现有的工具栏?

我已经看到“clearAggregation”:true应该确保只有一个工具栏,但是我的目标设置中的配置项没有被遵守。

我认为某些容器因为其预期用途而不遵守“ClearAggregation”,所以我的问题是我应该使用哪个容器,以便通过路由和导航系统填充区域?

具体目标:

"signedout-toolbar": { 
     "viewName": "SignedOutToolbar", 
     "controlId": "__component0---appframe--main-toolbar", 
     "controlAggregation": "content", 
     "clearAggregation": true 
    }, 
    "standard-toolbar": { 
     "viewName": "StandardToolbar", 
     "controlId": "__component0---appframe--main-toolbar", 
     "controlAggregation": "content", 
     "clearAggregation": true 
    }, 

根视图:

<mvc:View 
controllerName="cpanel.controller.App" 
xmlns:mvc="sap.ui.core.mvc" 
xmlns:xhtml="http://www.w3.org/1999/xhtml" 
displayBlock="true" 
xmlns="sap.m"> 

    <ToolBar id="main-toolbar" /> 

    <App id="app" /> 

</mvc:View> 

回答

0

clearAggregation是不是有效的属性,我认为。

根据您的版本,你必须使用clearTargetclearControlAggregation

如果你看看文档:

oConfig.clearTarget? @deprecated since 1.28 - use target.clearControlAggregation。默认为false。定义一个布尔型 ,可以传递该布尔值来指定在将视图添加到它之前是否应该清除聚合 。当使用sap.ui.ux3.Shell时,这个 应该是true。对于sap.m.NavContainer,它应该是错误的。

欲了解更多信息,看看here