如何设置具有表单字段的日历以提交约会? [英] How can I setup a Calendar that has a form field to submit appointments?

查看:205
本文介绍了如何设置具有表单字段的日历以提交约会?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试实施 planningCalendar 具有允许用户输入约会时间的形式。提交约会后,应自动显示在日历上。不确定如何实施此操作。



以下是链接到我已经构建的日历。

解决方案

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



以下代码应该与 SAP示例代码

  var model = this.getView()。getModel 
//你必须先找到人的索引。在这个例子中:0
var appointments = model.getProperty(/ people / 0 / appointments);
appointments.push({
start:myFormularsStartDate,
end:myFormularsEndDate,
title:myFormularsTitle,
...
});
model.setProperty(/ peaople / 0 / appointments,appointments);有关数据绑定在sapui5中的更多信息,我建议你把 < /sapui5.hana.ondemand.com/#docs/guide/3da5f4be63264db99f2e5b04c5e853db.htmlrel =nofollow>演练



此处 Plunker 示例。


I'm trying to implement the planningCalendar to have a form that allows a user to enter an appointment time. Once the appointment has been submitted, it should automatically be displayed on the Calendar. Not sure how to implement this.

Here's a link to the Calendar I have already constructed.

解决方案

You just have to update the model bound to the PlanningCalendar. The changes will automatically be reflected in the PlanningCalendar. You have to use the JSONModel.setProperty() to apply the changes to the model so that the model gets aware that there are changes. It will then update the bindings and with that the PlanningCalendar.

The following code should work with the SAP example code you have linked.

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);

For more information on databinding in sapui5 i would recommend you take the walkthrough.

Example Plunker here.

这篇关于如何设置具有表单字段的日历以提交约会?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆