SAP ui5表odata

时间:2015-06-02 09:46:12

标签: javascript sapui5

我有一个来自SAP BPMN的ODATA源,当我有扩展数据时,它会给出如下所示的响应。我从odata获取数据并在我的表中显示它有问题。该表未显示任何行。

OData可以在下面看到。我用以下方式绑定数据。

odataModel.read("/SAPBPMInputData('" + taskId + "')", null, ["$expand=startTypeINPUT/start/DO_SES/Lines"], false, function(data, response){
				// in case the response is incomplete, complement the model with dummy data objects
				ApproveSESComponent.DO_SES.util.ModelBuilder.completeJSONModelAccordingSchema(data, odataModel.getServiceMetadata().dataServices.schema[0], "SAPBPMInputData");
				var oODataJSONModel = new sap.ui.model.json.JSONModel(data);
				oODataJSONModel.setDefaultBindingMode("TwoWay");
				oView.setModel(oODataJSONModel);
				// eases the access for the controller
				oView.setModel(odataModel, "odataModel");
				oTable.setModel(oModel).bindRows("/Lines");
			}, function(oEvent){
				ApproveSESComponent.DO_SES.util.ErrorHandler.handleRequestFailedError(oEvent.response, resourceBundle);
			});

在我的表格视图中如下所示。

<core:FragmentDefinition xmlns="sap.m"
	xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form"  xmlns:t="sap.ui.table" xmlns:core="sap.ui.core">

		<Table
			headerText="{i18n>LineItemTableHeader}"
			items="{path: 'odataModel>/Lines'}" >
			<columns>
				<Column>
					<header><Label text="Products" /></header>
				</Column>
				
			</columns>
			<ColumnListItem
				type="Navigation"
				press="handleLineItemPress" >
				<cells>
					<ObjectIdentifier
						title="{ID}" />
					
						
				</cells>
			</ColumnListItem>
			</Table>
	</core:FragmentDefinition>

的OData:

{  
   "d":{  
      "__metadata":{  
         "id":"/bpmodata/taskdata.svc/d06785d9085e11e5bd990000062c3c6e/SAPBPMInputData('d06785d9085e11e5bd990000062c3c6e')",
         "uri":"/bpmodata/taskdata.svc/d06785d9085e11e5bd990000062c3c6e/SAPBPMInputData('d06785d9085e11e5bd990000062c3c6e')",
         "type":"BPMTaskData.SAPBPMInputData"
      },
      "EDM_Key":"d06785d9085e11e5bd990000062c3c6e",
      "startTypeINPUT":{  
         "__metadata":{  
            "id":"/bpmodata/taskdata.svc/d06785d9085e11e5bd990000062c3c6e/startTypeINPUT('d06785d9085e11e5bd990000062c3c6e_I_1')",
            "uri":"/bpmodata/taskdata.svc/d06785d9085e11e5bd990000062c3c6e/startTypeINPUT('d06785d9085e11e5bd990000062c3c6e_I_1')",
            "type":"BPMTaskData.startTypeINPUT"
         },
         "EDM_Key":"d06785d9085e11e5bd990000062c3c6e_I_1",
         "start":{  
            "__metadata":{  
               "id":"/bpmodata/taskdata.svc/d06785d9085e11e5bd990000062c3c6e/Form('d06785d9085e11e5bd990000062c3c6e_I_1_1')",
               "uri":"/bpmodata/taskdata.svc/d06785d9085e11e5bd990000062c3c6e/Form('d06785d9085e11e5bd990000062c3c6e_I_1_1')",
               "type":"BPMTaskData.Form"
            },
            "EDM_Key":"d06785d9085e11e5bd990000062c3c6e_I_1_1",
            "DO_SES":{  
               "__metadata":{  
                  "id":"/bpmodata/taskdata.svc/d06785d9085e11e5bd990000062c3c6e/DO_SES('d06785d9085e11e5bd990000062c3c6e_I_1_1_1')",
                  "uri":"/bpmodata/taskdata.svc/d06785d9085e11e5bd990000062c3c6e/DO_SES('d06785d9085e11e5bd990000062c3c6e_I_1_1_1')",
                  "type":"BPMTaskData.DO_SES"
               },
               "EDM_Key":"d06785d9085e11e5bd990000062c3c6e_I_1_1_1",
               "CustomerID":"23523",
               "CustDate":"\/Date(1433116800000+0180)\/",
               "Total":"230.0",
               "SESID":"235",
               "Lines":{  
                  "results":[  
                     {  
                        "__metadata":{  
                           "id":"/bpmodata/taskdata.svc/d06785d9085e11e5bd990000062c3c6e/LinesType('d06785d9085e11e5bd990000062c3c6e_I_1_1_1_1_1')",
                           "uri":"/bpmodata/taskdata.svc/d06785d9085e11e5bd990000062c3c6e/LinesType('d06785d9085e11e5bd990000062c3c6e_I_1_1_1_1_1')",
                           "type":"BPMTaskData.LinesType"
                        },
                        "EDM_Key":"d06785d9085e11e5bd990000062c3c6e_I_1_1_1_1_1",
                        "ID":"1",
                        "Description":"43",
                        "UnitPrice":"50.0",
                        "Quantity":"40.0",
                        "LineTotal":"20.0"
                     },
...... MORE LINEs
                  ]
               }
            }
         }
      }
   }
}

1 个答案:

答案 0 :(得分:0)

我错过了回复的结果部分。所以现在我的桌子就是。

<Table
     id="idLineTable"
        items="{path:'Lines/results'}"
  >