- Home
- Forum
- Angular - EJ 2
- context menu not working
context menu not working
Hi, I am trying to get context menu to work with angular schedule component.I am getting this error - TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
I followed this example - https://ej2.syncfusion.com/angular/demos/#/material/schedule/context-menu . However, I am using my own custom editor window which is not shown in the example. I also looked at https://www.syncfusion.com/forums/147954/contextmenu-on-listview-item and tried adding a wrapper div with class="tclass" and using that as my target (shown below), but still getting the same error.
<ejs-schedule #scheduleObj [firstDayOfWeek]="firstDayOfWeek" [showQuickInfo]="showQuickInfo" [workDays]='workWeekDays' [workHours]="scheduleHours" [(selectedDate)]="selectedDate" (actionComplete)="onTarget()" (actionBegin)="onActionBegin($event)" (popupOpen)="onPopupOpen($event)" (navigating)= "onNavigating($event)">
<ejs-contextmenu #menuObj cssClass='schedule-context-menu' target='.tclass' [items]='menuItems'
(beforeOpen)='onContextMenuBeforeOpen($event)' (select)='onMenuItemSelect($event)'></ejs-contextmenu>
<ng-template width="1000px" #editorTemplate>
<div class="tclass">
<table class="custom-event-editor" width="100%" cellpadding="5">
<tbody>
<tr>
<td class="e-textlabel">Description</td>
<td colspan="3">
<input id="description" name="description" class="e-field e-input" type="text" style="width: 100%" />
</td>
</tr></tbody></table></div>
SIGN IN To post a reply.
3 Replies
VD
Vinitha Devi Murugan
Syncfusion Team
October 21, 2019 10:24 AM UTC
Hi Jose,
Syncfusion Greetings.
With your shared code, we checked your reported issue in which you erroneously defined the context menu within the schedule tag, which is the cause. You need to define the context menu outside of the schedule tag to overcome this. Refer to sample below.
<ejs-schedule #scheduleObj height='650px' [selectedDate]="selectedDate" [allowResizing]="allowResizing"
[allowDragAndDrop]="allowDragDrop" [eventSettings]="eventSettings">
<ng-template width="1000px" #editorTemplate>
<div class="tclass">
<table class="custom-event-editor" width="100%" cellpadding="5">
<tbody>
<tr>
<td class="e-textlabel">Description</td>
<td colspan="3">
<input id="description" name="description" class="e-field e-input" type="text" style="width: 100%" />
</td>
</tr>
</tbody>
</table>
</div>
</ng-template>
</ejs-schedule>
<ejs-contextmenu #menuObj cssClass='schedule-context-menu' target='.e-schedule' [items]='menuItems'
(beforeOpen)='onContextMenuBeforeOpen($event)' (select)='onMenuItemSelect($event)'>
</ejs-contextmenu>
Regards,
M.Vinitha devi
JL
jose lara
October 21, 2019 12:45 PM UTC
good catch! I was focusing on other areas and didn't realize my syntax was wrong. thx
VD
Vinitha Devi Murugan
Syncfusion Team
October 22, 2019 06:24 AM UTC
Hi Jose,
Thanks for your update.
We are pleased that your problem has been resolved.
Regards,
M.Vinitha devi
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
JL jose lara
- Oct 21, 2019 01:44 AM UTC
- Oct 22, 2019 06:24 AM UTC