Odata SAP UI5中有两个键的行(项目)的预填充编辑页面

Odata SAP UI5中有两个键的行(项目)的预填充编辑页面,odata,sapui5,Odata,Sapui5,这是我的项目级页面,有两个键请求ID,配置文件ID 通过选择项目并按下编辑按钮,我将显示包含数据的编辑页面 代码编辑按钮按 this.getRouter().getTargets().display("CreateCandidate", { mode: "update", objectPath: sObjectPath }); 我来了 sObjectPath=“ZRecruit\u候选集(RegNo=1,ProId=1)” My

这是我的项目级页面,有两个键
请求ID,配置文件ID

通过选择项目并按下编辑按钮,我将显示包含数据的编辑页面

代码编辑按钮

this.getRouter().getTargets().display("CreateCandidate", {
            mode: "update",
            objectPath: sObjectPath
        });
我来了

sObjectPath=“ZRecruit\u候选集(RegNo=1,ProId=1)”

Mymanifest.json

"CreateCandidate":{
                "viewName": "CreateCandidate",
                "viewId": "cand_creation",
                "viewLevel":2
            },
/sap/opu/odata/SAP/ZRECRUITMENT_TRACKER_APP_SRV/
ZRECRUITMENT_CANDIDATESet(RegNo=1,ProId=2)?$format=xml
编辑
页面中,我应该将什么绑定到
表单
&编辑页面的模式URL应该是什么

对于标题行,我们将给出
ZENTITY\u SET/1

但是如果我们有两个键,我们将如何给出模式。它像是天顶集/1/2吗?请指导我这方面的工作

我的ODATA阅读查询:

"CreateCandidate":{
                "viewName": "CreateCandidate",
                "viewId": "cand_creation",
                "viewLevel":2
            },
/sap/opu/odata/SAP/ZRECRUITMENT_TRACKER_APP_SRV/
ZRECRUITMENT_CANDIDATESet(RegNo=1,ProId=2)?$format=xml
我的OData回复:


-
http://ttpl001.truspeq.com:8000/sap/opu/odata/SAP/ZRECRUITMENT_TRACKER_APP_SRV/ZRECRUITMENT_CANDIDATESet(RegNo=1,ProId=1)
ZRecruit_候选集(RegNo=1,ProId=1)
2018-07-19T20:09:00Z
-
-
1.
1.
多石的
4年
45000
750000
3个月
加尔各答
TCS
HHWQQ77
77778585
ROCKYKUMAR@TCS.COM
7745

请参阅配置路由器的文档

在manifest.json中:

...
"routes" : [
    {
        name: "createCandidate",
        pattern: "create/{RegNo}-{ProId}",
        target: "CreateCandidate"
    }
],
"targets": {
    "CreateCandidate": {
        "viewName": "CreateCandidate",
        "viewLevel": 2
},
....
然后导航到该视图:

oRouter.navTo("createCandidate", {
    RegNo: 1
    ProId: 1
})
然后在CreateCandidate控制器中

_onPatternMatched: function(oEvent) {
    // get the params RegNo and ProId from the event object - {RegNo: 1, ProId: 1}
    var oArgs = oEvent.getParameter("arguments"); 

    //use the ODataModel to create a binding path from the values
    var sBindingPath = this.getView().getModel().createKey("/ZRECRUITMENT_CANDIDATESet", oArgs);

    //Bind your view to the binding path
    this.getView().bindElement(sBindingPath); 
}

onInit: function() {
     //get the route object from the router
     var oRoute = this.getOwnerComponent().getRouter().getRoute("createCandiate");

     //attach an event to the route which is fired when the route pattern is matched
     oRoute.attachPatternMatched(this._onPatternMatched, this);
}

请参阅配置路由器的文档

在manifest.json中:

...
"routes" : [
    {
        name: "createCandidate",
        pattern: "create/{RegNo}-{ProId}",
        target: "CreateCandidate"
    }
],
"targets": {
    "CreateCandidate": {
        "viewName": "CreateCandidate",
        "viewLevel": 2
},
....
然后导航到该视图:

oRouter.navTo("createCandidate", {
    RegNo: 1
    ProId: 1
})
然后在CreateCandidate控制器中

_onPatternMatched: function(oEvent) {
    // get the params RegNo and ProId from the event object - {RegNo: 1, ProId: 1}
    var oArgs = oEvent.getParameter("arguments"); 

    //use the ODataModel to create a binding path from the values
    var sBindingPath = this.getView().getModel().createKey("/ZRECRUITMENT_CANDIDATESet", oArgs);

    //Bind your view to the binding path
    this.getView().bindElement(sBindingPath); 
}

onInit: function() {
     //get the route object from the router
     var oRoute = this.getOwnerComponent().getRouter().getRoute("createCandiate");

     //attach an event to the route which is fired when the route pattern is matched
     oRoute.attachPatternMatched(this._onPatternMatched, this);
}

您是否使用ob_start(ob_gzhandler)函数?如果是这样,并且如果您在ob_start(ob_gzhandler)函数之上输出任何内容,您将得到此错误。您不能使用此函数,也不能在此函数上方输出内容。ob_gzhandler回调函数将确定浏览器将接受哪种类型的内容编码,并相应地返回其输出。因此,如果在该函数上方输出内容,则内容的编码可能与ob_gzhandler的输出内容不同,从而导致此错误。

是否使用ob_start(ob_gzhandler)函数?如果是这样,并且如果您在ob_start(ob_gzhandler)函数之上输出任何内容,您将得到此错误。您不能使用此函数,也不能在此函数上方输出内容。ob_gzhandler回调函数将确定浏览器将接受哪种类型的内容编码,并相应地返回其输出。因此,如果您在该函数上方输出内容,则内容的编码可能与ob_gzhandler的输出内容不同,从而导致此错误。

您能解释一下问题所在吗?哪里做错了?您到底想要实现什么?单击“编辑”按钮,它将转到下一页并填充所选行的数据。在编辑页面中,我应该绑定到表单什么&编辑页面的模式URL应该是什么。对于标题行,我们将给出ZENTITY_SET/1类型。但是如果有两个键,我们将如何给出模式。它像ZENTITY_SET/1/2吗?请指导我关于这一点。就路由而言,您可以根据自己认为合适的方式定义它,只要您尊重您在导航时在manifest.json文件中放置的模式。由于编辑页面在特定实体的顶部工作,我建议在onInit方法上调用view.bindElement。这样,所有绑定都将与您刚才绑定的实体相关,这使得在视图中用数据绑定填充表单变得非常容易。@Kyle为您的问题提供了一个非常好的答案。您能解释一下问题是什么吗?哪里做错了?您到底想要实现什么?单击“编辑”按钮,它将转到下一页并填充所选行的数据。在编辑页面中,我应该绑定到表单什么&编辑页面的模式URL应该是什么。对于标题行,我们将给出ZENTITY_SET/1类型。但是如果有两个键,我们将如何给出模式。它像ZENTITY_SET/1/2吗?请指导我关于这一点。就路由而言,您可以根据自己认为合适的方式定义它,只要您尊重您在导航时在manifest.json文件中放置的模式。由于编辑页面在特定实体的顶部工作,我建议在onInit方法上调用view.bindElement。这样,所有绑定都将相对于您刚才绑定的实体,这使得在视图中用数据绑定填充表单变得非常容易。@Kyle为您的查询提供了一个非常好的答案Tank u very much@kyleThank u very much@Kyle