We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

context menu not working

Thread ID:





148452 Oct 21,2019 01:44 AM UTC Oct 22,2019 06:24 AM UTC Angular - EJ 2 3
Tags: Schedule
jose lara
Asked On October 21, 2019 01:44 AM UTC

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">
<td class="e-textlabel">Description</td>
<td colspan="3">
<input id="description" name="description" class="e-field e-input" type="text" style="width: 100%" />

Vinitha Devi Murugan [Syncfusion]
Replied On 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"> 
                <td class="e-textlabel">Description</td> 
                <td colspan="3"> 
                  <input id="description" name="description" class="e-field e-input" type="text" style="width: 100%" /> 
     <ejs-contextmenu #menuObj cssClass='schedule-context-menu' target='.e-schedule' [items]='menuItems' 
      (beforeOpen)='onContextMenuBeforeOpen($event)' (select)='onMenuItemSelect($event)'> 

M.Vinitha devi 

jose lara
Replied On October 21, 2019 12:45 PM UTC

good catch! I was focusing on other areas and didn't realize my syntax was wrong. thx

Vinitha Devi Murugan [Syncfusion]
Replied On October 22, 2019 06:24 AM UTC

Hi Jose, 
Thanks for your update. 
We are pleased that your problem has been resolved.  
M.Vinitha devi 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon