Data binding 由于templateShareable导致SAPUI5错误消息的解决方案:真?
自SAPUI5 1.28.20升级后,我收到以下错误消息: 共享模板必须在中标记为templateShareable:true 绑定信息 代码位于mangeObject.js中,如下所示:Data binding 由于templateShareable导致SAPUI5错误消息的解决方案:真?,data-binding,sapui5,Data Binding,Sapui5,自SAPUI5 1.28.20升级后,我收到以下错误消息: 共享模板必须在中标记为templateShareable:true 绑定信息 代码位于mangeObject.js中,如下所示: } else if ( oBindingInfo.templateShareable === MAYBE_SHAREABLE_OR_NOT ) { // a 'clone' operation implies sharing the template (if templ
} else if ( oBindingInfo.templateShareable === MAYBE_SHAREABLE_OR_NOT ) {
// a 'clone' operation implies sharing the template (if templateShareable is not set to false)
oBindingInfo.templateShareable = oCloneBindingInfo.templateShareable = true;
jQuery.sap.log.error("A shared template must be marked with templateShareable:true in the binding info");
}
oBindingInfo.templateShareable的值为true,可能\u SHAREABLE\u或\u NOT的值为1
根据文档,oBindingInfo.templateShareable的默认值为true
那么这里出了什么问题?图书馆里的虫子?还是我的代码?
另见:
SAPUI5版本1.32.x的更新
对于版本1.32.x,消息已更改,现在为:
模板已在绑定中重用,但已标记为
毁灭的候选者。你最好把这种用法用在
templateShareable:在绑定配置中为true-
但根据文档,默认值仍应为真:
{boolean}oBindingInfo.templateShareable?,默认值:true选项
启用该模板将被共享,这意味着它不会被共享
自动销毁或克隆
现在看起来,这会产生一些无休止的加载,我一次又一次地收到这个消息,直到浏览器崩溃。
有人知道可能是什么问题吗?如果模板是在绑定之外实例化的,则会出现此消息。例如: 此代码将在以下情况下工作:
new sap.m.Select({
items : {
path : "/Items",
template : new sap.ui.core.Item({
text : "{Name}"
})
}
})
此代码似乎产生了以下信息:
var oTemplate = new sap.ui.core.Item({
text : "{Name}"
})
new sap.m.Select({
items : {
path : "/Items",
template :oTemplate
}
})
这似乎解决了问题:
var oTemplate = new sap.ui.core.Item({
text : "{Name}"
})
new sap.m.Select({
items : {
path : "/Items",
template :oTemplate,
templateShareable : true
}
})
上面标记为正确的答案实际上根本不正确,因为这里的答案是错误的:
如果模板是在外部实例化的,则会出现此消息 装订。[…]此代码似乎生成以下消息:[…] 要证明以上操作系统的答案是错误的,只需运行此示例,SAPUI5 1.28.20具有相同的结果: SAPUI5单文件模板| nabisoft sap.ui.getCore.attachInitfunction{ 严格使用; var oModel=new sap.ui.model.json.JSONModel{ 项目:[ {姓名:Michael}, {姓名:约翰}, {姓名:弗兰克}, {姓名:Jane} ] }; sap.ui.getCore.setModeloModel; var oTemplate=new sap.ui.core.Item{ 文本:{Name} }; 新sap.m.Select{ 项目:{ 路径:/Items, 模板:oTemplate } }.placeAtcontent; };
我在下面的代码中仍然遇到同样的问题,因为我的XML片段的下拉选择也缺少“templateShareable”listView;XML片段:。。。我遇到了相反的问题。当第二次从Fiori launchpad进入应用程序时,它给了我一个错误:添加具有重复id的元素。。。对于ID为的模板。使用items={…,templateShareable:false}解决了该问题。v1.26