gpt4 book ai didi

javascript - SAPUI5 使用来自 XMII 的 OData 填充 SmartTable

转载 作者:行者123 更新时间:2023-11-28 07:07:47 28 4
gpt4 key购买 nike

我目前正在尝试使用我们的 MII 服务器中的 OData 填充智能表(xml View )。我不断收到以下错误:

错误:无法从 ./Component-changes.json 加载资源 PATH/Component-changes.json。检查“未找到文件”或解析错误。原因:未找到 -“getChanges”失败:-

这是我的 Main.controller.js:

sap.ui.controller("PATH.view.Main", {

/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
* @memberOf sapui5.Main
*/
onInit: function() {
var oModel, oView;
this.oUpdateFinishedDeferred = jQuery.Deferred();
this.getView().byId("main").attachEventOnce("updateFinished", function(){
this.oUpdateFinishedDeferred.resolve();
}, this);
sap.ui.core.UIComponent.getRouterFor(this).attachRouteMatched(this.onRouteMatched , this);

var oModel, oView;
oModel = new sap.ui.model.odata.ODataModel("http://server:port/XMII/IlluminatorOData/QueryTemplate?QueryTemplate=MessageMonitor%2FTemplates%2FQuery%2FMIILogDetailsQry&Content-Type=text%2Fxml", {annotationURI: "/XMII/IlluminatorOData/$metadata"});

jQuery.sap.log.error(oModel.getMetaModel());
oModel.setCountSupported(false);
var oTable = this.getView().byId("oTable");
oTable.setEntitySet("Messages");
oTable.setModel(oModel);
oView = this.getView();
oView.setModel(oModel);
oTable.rebindTable();
},
onRouteMatched : function(oEvent) {
var oList = this.getView().byId("main");
var sName = oEvent.getParameter("name");
var oArguments = oEvent.getParameter("arguments");
// Wait for the list to be loaded once
jQuery.when(this.oUpdateFinishedDeferred).then(jQuery.proxy(function() {
var aItems;
// On the empty hash select the first item
if (sName === "main") {
//this.selectDetail();
}
// Try to select the item in the list
if (sName === "product") {
aItems = oList.getItems();
for (var i = 0; i < aItems.length; i++) {
if (aItems[i].getBindingContext().getPath() === "/" +
oArguments.product) {
oList.setSelectedItem(aItems[i], true);
break;
}
}
}
}, this));
},
});

我正在服务器本身上进行开发,因此我对否则会遇到的 CORS 错误没有任何问题。

我的Main.view.xml:

<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar" xmlns:smartTable="sap.ui.comp.smarttable" controllerName="PATH.view.Main" height="100%" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1">
<Page id="main" title="{i18n>PageTitle}" showNavButton="false">
<Toolbar></Toolbar>
<content>
<smartFilterBar:SmartFilterBar id="smartFilterBar" entityType="Messages" persistencyKey="SmartFilter_Explored">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="CATEGORY">
<smartFilterBar:defaultFilterValues>
<smartFilterBar:SelectOption low="i">
</smartFilterBar:SelectOption>
</smartFilterBar:defaultFilterValues>
</smartFilterBar:ControlConfiguration>
<smartFilterBar:ControlConfiguration key="DATETIME">
<smartFilterBar:defaultFilterValues>
<smartFilterBar:SelectOption low="2014">
</smartFilterBar:SelectOption>
</smartFilterBar:defaultFilterValues>
</smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>

<smartTable:SmartTable id="oTable" entitySet="Messages"
smartFilterId="smartFilterBar" tableType="Table"
useExportToExcel="false" useVariantManagement="false"
useTablePersonalisation="false" header="Messages"
showRowCount="false"
persistencyKey="SmartTableAnalytical_Explored"
enableAutoBinding="true" />
</content>
</Page>

我的 Component.js、index.html 和 MyRouter.js 是根据 SAP Hana 分步指南为您的第一个应用程序设置的。

我完全不知道问题是什么。

提前致谢。

最佳答案

读取文件 component-changes.json 以进行变体管理,但这不应阻止加载智能表中的数据。既然您设置了enableAutoBinding,系统是否会调用您的服务/消息?

关于javascript - SAPUI5 使用来自 XMII 的 OData 填充 SmartTable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31563062/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com