【发布时间】:2021-04-14 08:23:12
【问题描述】:
我正在尝试使用 SAPUI5 中的 PlanningCalender。但是,当我切换到周视图时,我遇到了问题。在这里,靠近的约会被写在一个新的行中。但我不想要这种行为。所有约会都应该一个接一个地写,即使我再也看不懂约会的内容。 约会似乎有最小宽度。但我找不到改变这个约会宽度的方法。 有谁知道我怎样才能一个接一个地得到约会?
sap.ui.define([
'sap/ui/core/mvc/Controller',
'sap/ui/model/json/JSONModel',
'sap/m/Dialog',
'sap/m/Button'
],
function(Controller, JSONModel,Dialog, Button) {
"use strict";
var PageController = Controller.extend("sample1.View1", {
onInit: function () {
// create model
var oModel = new JSONModel();
oModel.setData({
startDate: new Date("2015", "11", "15", "8", "0"),
people: [
{
pic: "sap-icon://employee",
name: "John Doe",
role: "team member",
appointments: [
{
start: new Date("2015", "11", "15", "08", "30"),
end: new Date("2015", "11", "15", "10", "30"),
title: "Meeting",
type: "Type02",
tentative: false
},
{
start: new Date("2015", "11", "15", "10", "30"),
end: new Date("2015", "11", "15", "12", "0"),
title: "Team meeting",
info: "room 1",
type: "Type01",
pic: "sap-icon://sap-ui5",
tentative: false
},
{
start: new Date("2015", "11", "15", "12", "00"),
end: new Date("2015", "11", "15", "13", "30"),
title: "Lunch",
type: "Type03",
tentative: true
}
]
}
]
});
this.getView().setModel(oModel);
},
handleAppointmentSelect: function (oEvent) {
var oAppointment = oEvent.getParameter("appointment");
if (oAppointment) {
alert("Appointment selected: " + oAppointment.getTitle());
}else {
var aAppointments = oEvent.getParameter("appointments");
var sValue = aAppointments.length + " Appointments selected";
alert(sValue);
}
},
handleIntervalSelect:function(oEvent){
var dialogData = {
newEntry: {
start: oEvent.getParameter("startDate"),
end: oEvent.getParameter("endDate"),
title: "",
info: "",
type: "Type01",
pic: "sap-icon://sap-ui5",
tentative: false
},
people: this.getView().getModel().getProperty("/people").map(function(p,i){ return { name: p.name, index: i, selected: true }; }) //A List of all people. All selected by default.
};
var dialogModel = new JSONModel(dialogData);
var that = this;
var planningDialog = new Dialog({
title:"Add Appointment",
content: sap.ui.xmlview({viewName:"sample1.AppointmentDialog"}).setModel(dialogModel),
leftButton: new Button({
text: "Cancel",
press: function(){
planningDialog.close();
planningDialog.destroy();
}}),
rightButton: new Button({
text: "Save",
type: "Accept",
press: function(){
planningDialog.close();
that.addAppointment(dialogData);
}}),
});
planningDialog.open();
},
addAppointment:function(data){
var model = this.getView().getModel();
var peopleList = model.getProperty("/people");
data.people
.filter(function(p){return p.selected;})
.forEach(function(p){
peopleList[p.index].appointments.push(data.newEntry);
});
model.setProperty("/people",peopleList); //Updates Bindings
}
});
return PageController;
});
【问题讨论】:
标签: sapui5 width appointment