我正在我们的应用程序中实现Angular的kendo调度器。如何做到这一点?当我点击" add“按钮时,我试图通过发送keydown事件来添加新的事件,但是它不起作用(通常当我在kendo调度器中有焦点并在键盘窗体上按下"c”时出现。有什么想法吗?
我添加新事件的代码:
addNewEvent(component: SchedulerComponent) {
const scheduler = document.getElementsByTagName('kendo-scheduler')[0];
scheduler.dispatchEvent(
new KeyboardEvent(
'keydown', {key: 'c'} //first solution
)
);
component.addEvent({//second solution
start: new Date(), //when saving only start and end fields are filled, but only with those values, not with those selected on form
end: new Date(),
});
}发布于 2021-11-24 13:14:29
答案是升级后的第二个解决方案,需要创建并分配新的formGroup:
this.form = this.formBuilder.group({
taskId: 0,
title: '',
description: '',
start: new Date(),
end: new Date(),
startTimezone: null,
endTimezone: null,
isAllDay: false,
recurrenceRule: null,
recurrenceException: null
});
component.addEvent(this.form);https://stackoverflow.com/questions/70063782
复制相似问题