SAPUI5从XMII填充数据表
SAPUI5 Filling SmartTable with OData from XMII
我目前正试图填充一个智能表(xml视图)与OData从我们的MII服务器。我一直得到以下错误:
错误:resource PATH/Component-changes。无法从。/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>
My Component.js、index.html和MyRouter.js都是根据SAP Hana的分步指南来设置的。
我完全不知道是什么问题。
文件组件更改。json是为变量管理读取的,但这不应该阻止智能表中的数据加载。既然你设置了enableAutoBinding,系统会调用你的Service/Messages吗?
我最终做了一些完全不同的事情,因为元数据不是我需要的Smart-Table的正确数据。谢谢你对问题的回答。
我已经在控制器中创建了一个默认表,其中填充了我需要和想要的列。我已经把行和列绑定了
var oTable = new sap.ui.table.Table();
oTable.addColumn(new sap.ui.table.Column({label: "{i18n>Category}", editable: false,
template: new sap.ui.commons.TextField( {
value: {
path: "CATEGORY",
formatter: sap.ui.demo.table.util.Formatter.label,
},
editable : false,
}), sortProperty: "Category" }));
// more addColumn lines...
oTable.setSelectionMode(sap.ui.table.SelectionMode.Single); // Single select mode.
oTable.bindRows({ // bind the rows to the odata model.
path: '/Rowset(QueryTemplate=''MessageMonitor/Templates/Query/UniqueGUIDs'',RowsetId=''1'')/Row',
});
this.getView().byId("idIconTabBar").insertContent(oTable); // add the table to the icontabbar
相关文章:
- 如何使用多维JSON数据重新填充表单
- 单击一个数据表,填充第二个数据表
- 使用 ajax 从 mysql 填充 jQuery 数据表
- 使用 php 发送 json 填充数据表
- 数据表将字段值关联到按钮,而 ajax 填充表
- C# MVC 填充数据表中的下拉列表组
- 用Firebase和Angular填充数据表
- 使用JSON URL数据动态填充HTML表
- 突出显示表上由assync请求数据动态填充的行
- 表没有被填充从Ajax调用使用数据表插件的jQuery
- Javascript数据表填充数据问题(没有返回错误)
- 用来自rails api的表单提交的新数据重新填充Angular应用的数据
- 用MySQL填充jQuery数据表
- Jquery数据表在表单发布后填充
- 在数据表上填充数据不起作用
- 动态填充Jquery数据表
- SAPUI5从XMII填充数据表
- 动态javascript的头部标签从数据表填充- asp.net
- 使用来自不同页面的数据自动填充表单
- 用下拉菜单和PHP填充jQuery数据表