将 SimplePlanningCalendar 添加到 UI5 应用程序失败并出现“getKey”错误
Adding a SimplePlanningCalendar to a UI5 app fails with `getKey` error
当我将 SimplePlanningCalendar
添加到我的应用程序时,出现以下错误。
我在我的应用程序中添加了具有最小配置的日历。
<IconTabBar xmlns="sap.m"
id="idCategoryMenu"
selectedKey="Home"
headerMode="Inline"
stretchContentHeight="true"
applyContentPadding="false"
select=".onSelectCategory"
items="{
path: 'backend>/CategorySet',
parameters: {
expand: 'Reports'
},
sorter: {
path: 'Sort'
},
templateShareable: true
}">
<items>
<IconTabFilter id="myIconTabFilter" key="{backend>Uuid}" text="{backend>Name}">
<!-- ... -->
<SinglePlanningCalendar>
<appointments>
<unified:CalendarAppointment xmlns:unified="sap.ui.unified"
title="{title}"
startDate="{startDate}"
endDate="{endDate}"
/>
</appointments>
</SinglePlanningCalendar>
<!-- ... -->
</IconTabFilter>
</items>
</IconTabBar>
当我调试应用程序时,我来到 SinglePlanningCalendar.js
中的以下行,其中请求给定 vView
参数中的键,但该参数仅包含一个字符串。
其他人以前遇到过这个问题并且知道为什么或如何解决这个问题吗?
问题是由我用于开发的当前版本 (1.71.21) 中的控件实现本身引起的。
commit 45696fe
中的修复从 UI5 1 开始可用。75.x。
因为我不能改变我的版本,我在我的包中实现了给定的解决方案:
{ // Controller
onInit: function () {
// ...
this.calendarTemporaryFix(); // Not needed since UI5 1.75
},
calendarTemporaryFix: function () {
// SinglePlanningCalendar required from "sap/m/SinglePlanningCalendar"
const fnSetSelectedView = SinglePlanningCalendar.prototype.setSelectedView;
SinglePlanningCalendar.prototype.setSelectedView = function (vView) {
if (typeof vView === "string") {
vView = sap.ui.getCore().byId(vView);
}
return fnSetSelectedView.call(this, vView);
};
},
// ...
}
当我将 SimplePlanningCalendar
添加到我的应用程序时,出现以下错误。
我在我的应用程序中添加了具有最小配置的日历。
<IconTabBar xmlns="sap.m"
id="idCategoryMenu"
selectedKey="Home"
headerMode="Inline"
stretchContentHeight="true"
applyContentPadding="false"
select=".onSelectCategory"
items="{
path: 'backend>/CategorySet',
parameters: {
expand: 'Reports'
},
sorter: {
path: 'Sort'
},
templateShareable: true
}">
<items>
<IconTabFilter id="myIconTabFilter" key="{backend>Uuid}" text="{backend>Name}">
<!-- ... -->
<SinglePlanningCalendar>
<appointments>
<unified:CalendarAppointment xmlns:unified="sap.ui.unified"
title="{title}"
startDate="{startDate}"
endDate="{endDate}"
/>
</appointments>
</SinglePlanningCalendar>
<!-- ... -->
</IconTabFilter>
</items>
</IconTabBar>
当我调试应用程序时,我来到 SinglePlanningCalendar.js
中的以下行,其中请求给定 vView
参数中的键,但该参数仅包含一个字符串。
其他人以前遇到过这个问题并且知道为什么或如何解决这个问题吗?
问题是由我用于开发的当前版本 (1.71.21) 中的控件实现本身引起的。
commit 45696fe
中的修复从 UI5 1 开始可用。75.x。
因为我不能改变我的版本,我在我的包中实现了给定的解决方案:
{ // Controller
onInit: function () {
// ...
this.calendarTemporaryFix(); // Not needed since UI5 1.75
},
calendarTemporaryFix: function () {
// SinglePlanningCalendar required from "sap/m/SinglePlanningCalendar"
const fnSetSelectedView = SinglePlanningCalendar.prototype.setSelectedView;
SinglePlanningCalendar.prototype.setSelectedView = function (vView) {
if (typeof vView === "string") {
vView = sap.ui.getCore().byId(vView);
}
return fnSetSelectedView.call(this, vView);
};
},
// ...
}