我已经开发了一个ui5应用程序,并在其中创建了一个新的自定义控件。我将新的控件js- MyInput.js保存到我的webapp的“控件”路径中(在我的示例中,控件“MyControl”的文件MyInput.js)。在WebIDE中运行我的应用程序进行测试运行时没有任何问题。但在将应用程序部署到abap系统后,我现在收到来自XMLTemplateManager的错误消息,它找不到对象类。
下面是使用my Control的my View的简短版本:
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.uxap" xmlns:layout="sap.ui.layout" xmlns:m="sap.m" xmlns:forms="sap.ui.layout.form"
xmlns:core="sap.ui.core" xmlns:ssuc="sap.suite.ui.commons" xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:table="sap.ui.table" xmlns:cmns="sap.ui.commons"
xmlns:dvp="de.fiori4cls.Fi4ClsFV.control"
controllerName="de.fiori4cls.Fi4ClsFV.controller.FVView" displayBlock="true">
<m:Shell id="shell">
<m:App id="app">
<m:pages>
<m:Page id="fvViewPage" title="{i18n>SachPruef}">
<m:content>
<dvp:MyInput
value="{ path : 'Cls>/Currency', type : 'sap.ui.model.type.String' }"
vhTitle="{i18n>Currency}"/>
</m:content>
</m:Page>
</m:pages>
</m:App>
</m:Shell>
</mvc:View> 这里'de.fiori4cls.Fi4ClsFV‘是我的应用程序的Id (在manifest.json中,在属性'id’的'sap.app‘部分下声明。
你知道为什么它在WebIDE测试中运行,为什么在部署到abap系统时抛出上面提到的错误吗?
kind谈Matthias
发布于 2020-05-06 17:03:06
我自己用调试,尝试和错误的组合解决了这个问题:-)
对于那些你在这里遇到类似问题的人,解决方案。问题出在我控制的定义上。因此,到目前为止,视图上的一切都还好(参见上面的问题)。
但是我的(简化的test-)控件是这样开始的:
return Input.extend("MyInput", {
"metadata": {
"properties": {
// Title of Value-Help Dialog
"vhTitle" : { type : "string", defaultValue :"Title" }
}
},
init : function() {
// Call inherited Method
Input.prototype.init.call(this);
this.setShowValueHelp(true);
this.attachValueHelpRequest(this.onValueHelpRequest);
},
renderer: sap.m.InputRenderer,
// ======= Events
onValueHelpRequest : function(oEvent) {
var me = this;
console.log("MyInput->onValueHelpRequest->Entering");
var lvTitle = this.getVhTitle();
alert (lvTitle);
}
});我发现这可以在UI5版本1.54及更高版本上运行。但不是UI5版本的blow 1.54。解决了这个问题的是,完全支持具有其命名空间的控件类。在那之后,我遇到了另一个问题,我的渲染器函数没有定义。我只想继承扩展控件的渲染器,因为它不会对渲染本身进行任何更改。这里的关键是在引号中设置渲染器类。
因此,这里是我的完全工作的测试控件,现在可以在ui5 1.44和更高版本上运行。
return Input.extend("de.fiori4cls.Fi4ClsFV.control.MyInput", {
"metadata": {
"properties": {
// Title of Value-Help Dialog
"vhTitle" : { type : "string", defaultValue :"Title" }
}
},
init : function() {
// Call inherited Method
Input.prototype.init.call(this);
this.setShowValueHelp(true);
this.attachValueHelpRequest(this.onValueHelpRequest);
},
renderer: "sap.m.InputRenderer",
// ======= Events
onValueHelpRequest : function(oEvent) {
var me = this;
console.log("MyInput->onValueHelpRequest->Entering");
var lvTitle = this.getVhTitle();
alert (lvTitle);
}
});将此应用于我的“真实”控件,使其运行:-)
kind谈Matthias
https://stackoverflow.com/questions/61615916
复制相似问题