【问题标题】:SAPUI5 Planning Calendar need appointments in one lineSAPUI5计划日历需要一行中的约会
【发布时间】:2021-04-14 08:23:12
【问题描述】:

我正在尝试使用 SAPUI5 中的 PlanningCalender。但是,当我切换到周视图时,我遇到了问题。在这里,靠近的约会被写在一个新的行中。但我不想要这种行为。所有约会都应该一个接一个地写,即使我再也看不懂约会的内容。 约会似乎有最小宽度。但我找不到改变这个约会宽度的方法。 有谁知道我怎样才能一个接一个地得到约会?

Plunker Example

       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


    【解决方案1】:

    setBuiltInViews 为属性 builtInViews 设置新值。

    将预定义视图列表定义为数组。视图应由它们的键指定。

    默认预定义视图及其键可在 sap.m.PlanningCalendarBuiltInView 获得。

    注意:如果设置,所有指定的视图将与任何自定义视图(如果可用)一起显示。如果未设置且没有自定义视图可用,则将显示所有默认视图。如果未设置且有任何自定义视图可用,则仅显示自定义视图。

    当使用 null 或 undefined 值调用时,将恢复属性的默认值。

    默认值为 []。

    您正在寻找的是某种调整 - sap.m.PlanningCalendarBuiltInView.Week。

    还没有解决,正在寻找解决方案!万事如意!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-01-25
      • 2023-02-02
      • 1970-01-01
      • 2016-10-30
      • 1970-01-01
      • 2018-11-26
      • 1970-01-01
      相关资源
      最近更新 更多