Fiori - 跨应用导航 [英] Fiori - Cross Application Navigation

查看:30
本文介绍了Fiori - 跨应用导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在启动板中的应用程序之间导航.我通过大量搜索发现,通过 ushell 中的 CrossApplicationNavigation 是一种方法.这是文档链接(SAPUI5 SDK - 演示工具包)

I want to navigate between the applications in launchpad. I have found with lot of searching that, through CrossApplicationNavigation in ushell is the way. Here is the link to documentation (SAPUI5 SDK - Demo Kit)

启动板中的每个应用程序都有用于进一步导航的语义对象"和操作".

Each application in launchpad has 'semantic object' and 'action' for further navigation.

我遵循文档并编写了以下代码来创建 CrossApplicionNavigation 服务.

I have followed documentation and written following piece of code to create CrossApplicaionNavigation service.

var fgetService =sap.ushell && sap.ushell.Container && sap.ushell.Container.getService;
this.oCrossAppNavigator = fgetService && fgetService("CrossApplicationNavigation");

为了确保 oCrossAppNavigator 服务正确启动,编写了以下代码.

Just to make sure that oCrossAppNavigator service is properly initiate wrote following code.

var hashForApp =  this.oCrossAppNavigator.hrefForExternal({
            rget : { semanticObject : "SalesOrder",action : "create" }
});
console.log("Hash for the application: " + hashForApp);

console Output: #SalesOrder-create

因此知道该服务有效,我编写了以下代码以导航到SalesOrder"应用程序和创建"操作.

So knowing the service works, I wrote following code to navigate to the "SalesOrder" application and to the "create" action.

this.oCrossAppNavigator.toExternal({
    target : { semanticObject : "SalesOrder",action : "create" }
});

这是我的问题.上述语句既不会进入 SalesOrder 应用程序,也不会在控制台中打印任何错误.它应该使用上述哈希码更新 URL 并转到该应用程序.

Here is the my issue. Above statement neither goes to the SalesOrder application nor prints any error in the console. It supposed to update the URL with the above hash code and go to that application.

注意:使用上述哈希码手动更改 URL 正确进入 SalesOrder 应用程序.

Note: Manual changing of URL with the above hash code correctly going to SalesOrder application.

提前致谢,

瓦格利

推荐答案

您是否尝试在本地运行此程序?因为如果是这样,那么它不会按预期工作,除非两个应用程序(您添加了跨应用程序代码的应用程序SalesOrder-create"应用程序)都在"本地沙箱"

Are you trying to run this locally? Because if so, then it doesn't work as expected, unless both the applications (the app where you've added the cross app code and the 'SalesOrder-create' app) are running in the "local sandbox"

但是,如果您尝试在安装在 Fiori Launchpad 中的应用程序中运行这段代码,该应用程序具有SalesOrder"-在同一个启动板中创建'应用程序,那么它应该可以正常工作.

However if you have tried to run this piece of code in an app installed in a Fiori Launchpad on an SAP dev/test system, which also has the 'SalesOrder-create' app in the same launchpad, then it should work just fine.

同样使用下面的方式来检查跨应用服务是否正常工作,因为看起来你的代码总是输出#SalesOrder-create

Also use the following way to check if the cross-app service is working, because it looks like your code always outputs #SalesOrder-create

if (sap.ushell && sap.ushell.Container && sap.ushell.Container.getService)
{
  var oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");

   oCrossAppNavigator.toExternal({
                      target: { semanticObject : "SalesOrder", action: "create" },   //the app you're navigating to 
                        // params : { param1:data, param2:data}
                     }); 
  }
else
{
     jQuery.sap.log.info("Cannot Navigate - Application Running Standalone");
 }
}

这篇关于Fiori - 跨应用导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆