В настоящее время я пытаюсь расширить CalendarAppointment (Календарь планирования). Я сейчас застрял, и я мог бы использовать несколько советов, чтобы вернуть меня на моем пути.
Я пытаюсь добавить свойство "проект" в значение CalendarAppointment. Код ниже - это то, что у меня есть до сих пор.
Это 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>
Это контроллер с некоторыми жестко назначенными встречами
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
}
});
}
);
Будем очень благодарны за любые предложения или советы.
Спасибо, Дэвид
Свойство "проект" было введено неверным образом. Нет такой вещи, как "редактируемый". Прочтите статью документации.
И отличный пост о пользовательских элементах управления.