如何设置具有表单字段以提交约会的日历?

时间:2016-10-07 20:18:15

标签: calendar sap sapui5

我正在尝试实现planningCalendar以获得允许用户输入约会时间的表单。提交约会后,它将自动显示在日历上。不知道如何实现这一点。

这是我已经构建的日历的link

2 个答案:

答案 0 :(得分:0)

我真的不明白这个问题。如果您查看示例的code,则可以非常清楚地了解如何使用此控件。您可以使用DateTime Picker来表示日期和时间,也可以使用表单中的其他字段来完成标题。

答案 1 :(得分:0)

您只需更新绑定到PlanningCalendar的模型即可。更改将自动反映在PlanningCalendar中。您必须使用JSONModel.setProperty()将更改应用于模型,以便模型知道存在更改。然后它将更新绑定以及PlanningCalendar。

以下代码适用于您已关联的SAP example code

var model = this.getView().getModel();
//You will have to find the index of the person first. in this example: 0
var appointments = model.getProperty("/people/0/appointments");
appointments.push({
   start: myFormularsStartDate,
   end: myFormularsEndDate,
   title: myFormularsTitle,
   ...
});
model.setProperty("/peaople/0/appointments",appointments);

有关sapui5中数据绑定的更多信息,我建议你选择walkthrough

示例Plunker此处。