gpt4 book ai didi

javascript - 扩展 sap.ui.unified.CalendarAppointment

转载 作者:行者123 更新时间:2023-11-28 04:03:35 26 4
gpt4 key购买 nike

我目前正在尝试延长日历约会(计划日历)。我现在陷入了困境,我可以使用一些技巧来让我重新回到正轨。

我正在尝试将字符串属性“project”添加到 CalendarAppointment。下面的代码是我到目前为止所拥有的。

XML

这是我现在使用的 XML。

  <mvc:View
controllerName="be.amistaplanningadmintool.controller.Board"
xmlns:mvc="sap.ui.core.mvc"
xmlns:unified="sap.ui.unified"
xmlns:custom="be.amistaplanningadmintool.controls"
xmlns="sap.m">
<VBox class="sapUiSmallMargin">
<PlanningCalendar
id="PC1"
startDate="{path: '/startDate'}"
rows="{path: '/people'}"
appointmentsVisualization="Filled"
appointmentSelect="handleAppointmentSelect"
showEmptyIntervalHeaders="false">
<toolbarContent>
<Title text="Title" titleStyle="H4"/>
</toolbarContent>
<rows>
<PlanningCalendarRow
icon="{pic}"
title="{name}"
text="{role}"
appointments="{path : 'appointments', templateShareable: 'true'}"
intervalHeaders="{path: 'headers', templateShareable: 'true'}">
<appointments>
<custom:CalendarAppointment
startDate="{start}"
endDate="{end}"
icon="{pic}"
title="{title}"
text="{info}"
type="{type}"
tentative="{tentative}"
project="{project}">
</custom:CalendarAppointment>
</appointments>
<intervalHeaders>
<unified:CalendarAppointment
startDate="{start}"
endDate="{end}"
icon="{pic}"
title="{title}"
type="{type}">
</unified:CalendarAppointment>
</intervalHeaders>
</PlanningCalendarRow>
</rows>
</PlanningCalendar>
</VBox>
</mvc:View>

Controller

这是带有一些硬编码约会的 Controller

        sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/ui/model/json/JSONModel",
"sap/m/MessageBox",
"be/amistaplanningadmintool/controls/CalendarAppointment"
],
function(Controller, JSONModel, MessageBox) {
"use strict";
return Controller.extend("be.amistaplanningadmintool.controller.Board", {

onInit: function() {
var oModel = new JSONModel();
oModel.setData({
startDate: new Date("2017", "0", "15", "8", "0"),
people: [{
pic: "test-resources/sap/ui/demokit/explored/img/John_Miller.png",
name: "John Miller",
role: "team member",
appointments: [{
start: new Date("2017", "0", "15", "13", "30"),
end: new Date("2017", "0", "15", "17", "30"),
title: "Discussion with clients",
info: "online meeting",
type: "Type02",
tentative: false,
project: "test project"
}]
}]
});
this.getView().setModel(oModel);

},

handleAppointmentSelect: function(oEvent) {
var oAppointment = oEvent.getParameter("appointment");
if (oAppointment) {
MessageBox.show("Appointment selected: " + oAppointment.getTitle());
} else {
var aAppointments = oEvent.getParameter("appointments");
var sValue = aAppointments.length + " Appointments selected";
MessageBox.show(sValue);
}
}

});
});

控制

这是我用来尝试扩展当前控件的控件。

    sap.ui.define(
["sap/ui/unified/CalendarAppointment"],
function(CalendarAppointment) {
return CalendarAppointment.extend("be.amistaplanningadmintool.controls.CalendarAppointment",{
metadata: {
properties: {
project: "string"
}
},
renderer: function(oRm, oControl){
sap.ui.unified.CalendarAppointmentRenderer.render(oRm, oControl); //use supercass renderer routine
}
});
}
);

任何建议或提示将不胜感激。

谢谢大卫

最佳答案

“项目”属性以错误的方式引入。不存在“可编辑”这样的东西。阅读文档 article .

太棒了post关于自定义控件。

关于javascript - 扩展 sap.ui.unified.CalendarAppointment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46884959/

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