2017-08-04 61 views
0

我正在設計一個具有2個XML和1個HTML視圖的SAP UI5應用程序。我想要從單擊按鈕導航到XML視圖的HTML視圖。我怎樣才能爲此設置路由。如何在sapui5中從XML視圖調用HTML視圖

下面的代碼是不工作:

routing: { 
    config: { 
     routerClass: "sap.m.routing.Router", 
     viewType: "XML", 
     viewPath: "executive.WebContent.view", 
     controlId: "app", 
     controlAggregation: "pages", 

    }, 

    routes: [{ 
      "pattern": "", 
      "name": "View1", 
      "viewPath": "executive.WebContent.view", 
      "viewType": "XML", 
      "target": "View1" 
     }, 
     { 
      "pattern": "Login", 
      "name": "View2", 
      "viewPath": "executive.WebContent.view", 
      "viewType": "XML", 
      "target": "View2" 
     }, 

     { 
      "pattern": "Visitor", 
      "name": "View3", 

      "viewPath": "executive.WebContent.view", 
      "viewType": "HTML", 
      "target": "View3" 


     } 
    ], 

    targets: { 
     "View1": { 
      "viewName": "Main" 

     }, 
     "View2": { 
      "viewName": "Login" 

     }, 
     "View3": { 
      "viewName": "Visitor" 

     } 
    } 

} 

讓我知道,這個解決方案。

+0

正好沒有工作是什麼,任何錯誤?你如何做導航?需要更多信息。 –

回答

0

就我所見,您正在路由的配置部分中定義全局類型XML;這將導致你的路線衝突。

我試圖做你現在想做的事情。但是,我找到了另一種解決方案。您可以擁有第三個XML視圖,在XML內部可以嵌入HTML視圖。是這樣的:

<mvc:HTMLView id="nestedViewhtmnl" 
viewName="executive.WebContent.view" 
controller="executive.controller.xx" type="HTML"></mvc:HTMLView> 

我希望這可以幫助你=)

+0

感謝David提供替代解決方案,但請告訴我,如果上述問題存在直接解決方案(不是解決方法) –