-2
使用路由時,我無法將我的上下文綁定到sap.m.table。在SplitApp,當我點擊主頁面線項目,採用SAPUI5使用上下文路由顯示沒有數據
contextarg = decodeURIComponent(evt.getParameter("arguments").ctx);
現在我瀏覽到詳細信息頁面和上下文,我已經過了使用
var url = "***/sap/opu/odata/SAP/ZFIRST_VENDOR_SRV";
var olineOdataModel = new sap.ui.model.odata.ODataModel(url,false);
var rd = contextarg+ "/VENDORITEMSSet";
olineOdataModel.read(rd,
null,
null,
false,
function(oData, oResponse){
var oODataJSONModel = new sap.ui.model.json.JSONModel();
oODataJSONModel.setData(oData);
// store the model
var lineTable = sap.ui.getCore().byId("__xmlview5--lineItemTable");
lineTable.setModel(oODataJSONModel,"localModel");
console.log(lineTable.getModel("localModel"));
控制檯這個參數去OData的顯示輸出作爲
,我已經照
與表結合<Table id="lineItemTable" headerText="Line Items" items="{'/results'}">
<columns>
<Column>
<header>
<Label text="Product ID" />
</header>
</Column>
<Column>
<header>
<Label text="Product Name" />
</header>
</Column>
<Column>
<header>
<Label text="Product Price" />
</header>
</Column>
<Column>
<header>
<Label text="Product Weight (gms)" />
</header>
</Column>
<Column>
<header>
<Label text="Available From" />
</header>
</Column>
</columns>
<ColumnListItem>
<cells>
<ObjectIdentifier title="{ProductId}" />
<ObjectIdentifier title="{ProductName}" />
<ObjectIdentifier title="{ProductPrc}" />
<ObjectIdentifier title="{ProductWt}" />
<ObjectIdentifier title="{AvailableFrom}" />
</cells>
</ColumnListItem>
</Table>
但是我在視圖中沒有數據。我試過items="{'results'}"
和items="{path:'results'}"
。請幫助。我在這裏做了什麼錯誤?!