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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cannot select the recurrence element in Scheduler's popup

Thread ID:

Created:

Updated:

Platform:

Replies:

149788 Dec 9,2019 03:42 PM UTC Dec 12,2019 05:32 PM UTC Angular - EJ 2 3
loading
Tags: Schedule
Alireza Kahaei
Asked On December 9, 2019 03:42 PM UTC

Hi,

I'm trying to follow the instructions for adding recurrence to the scheduler's popup but it doesn't work for some reason because the popup's content is still not in the DOM. What am I doing wrong?

Here is the HTML:

<div class="control-section" >
  <!-- <div class="col-lg-12 content-wrapper"> -->
    <ejs-schedule #scheduleObj cssClass='timeline-resource-grouping' [selectedDate]="selectedDate" [group]="group"
      [eventSettings]="eventSettings" [firstDayOfWeek]='1' (actionComplete)="onAction($event)"
      (popupOpen)="onPopupOpen($event)" (resizeStop)="onResizeStop($event)" (dragStop)="onDragStop($event)"
      (eventRendered)="eventRendered($event)" (actionBegin)="onActionBegin($event)" (navigating)="onNavigate($event)"
      [(currentView)]="currentView">

      <ng-template #editorTemplate let-data>
        <table *ngIf="data !== undefined" class='custom-event-editor' cellpadding='5'>
          <tbody>
            <tr>
              <td class='e-textlabel'>Title</td>
              <td class='e-textlabel'>Location</td>
            </tr>
            <tr>
              <td>
                <input id="Subject" class="e-field e-input" type="text" [(ngModel)]="data.Subject" (ngModelChange)='validateSubject($event)' data-name="Subject" />
                <input type="hidden" name="Id" data-name="Id" class="e-field" [(ngModel)]="data.Id" />
              </td>
              <td>
                <ejs-dropdownlist id="EntityId" class="e-field" data-name="EntityId" [dataSource]='entityDataSource'
                  [(ngModel)]="data.EntityId" [fields]='dropDownFieldsMapping'></ejs-dropdownlist>
              </td>
            </tr>
            <tr>
              <td colspan="2">
                  <div id='RecurrenceEditor'></div>
              </td>
            </tr>
            <tr>
              <td class='e-textlabel'>Start</td>
              <td class='e-textlabel'>End</td>
            </tr>
            <tr>
              <td>
                <ejs-datetimepicker #startTimePicker id="StartTime" class="e-field" data-name="StartTime"
                  format="dd.MM.yyyy H:mm" [(ngModel)]='data.startTime || data.StartTime' [firstDayOfWeek]='1'
                  timeFormat="HH:mm" (change)='AppointmentTimeSelectionChanged($event)'></ejs-datetimepicker>
              </td>
              <td>
                <ejs-datetimepicker #endTimePicker id="EndTime" class="e-field" data-name="EndTime"
                  format="dd.MM.yyyy H:mm" [(ngModel)]='data.endTime || data.EndTime' [firstDayOfWeek]='1'
                  timeFormat="HH:mm" (change)='AppointmentTimeSelectionChanged($event)'></ejs-datetimepicker>
              </td>
            </tr>
            <tr>
              <td>
                <ejs-checkbox id="IsAllDay" class="e-field" label="All day" data-name="IsAllDay"
                  [(ngModel)]="data.IsAllDay"></ejs-checkbox>
              </td>
            </tr>
            <tr>
              <td class='e-textlabel' colspan="2">Booker</td>
            </tr>
            <tr>
              <td colspan="2">
                <ejs-dropdownlist id="BookerEntityId" class="e-field" data-name="BookerEntityId"
                  [dataSource]='bookerList' [(ngModel)]='data.BookerEntityId' [fields]='bookerFieldsMapping'>
                </ejs-dropdownlist>
              </td>
            </tr>
            <tr>
              <td class='e-textlabel' colspan="2">Description</td>
            </tr>
            <tr>
              <td colspan="2">
                <textarea id="Description" class="e-field e-input" data-name="Description" rows="3" cols="50"
                  [(ngModel)]="data.Description"
                  style="width: 100%; height: 60px !important; resize: vertical"></textarea>
              </td>
            </tr>
          </tbody>
        </table>
      </ng-template>

      <e-resources>
        <e-resource field='GroupId' title='Group' [dataSource]='groupDataSource' [allowMultiple]='false' name='Entities'
          textField='text' idField='id'>
        </e-resource>
        <e-resource field='EntityId' title='Room' [dataSource]='entityDataSource' [allowMultiple]='false' name='Groups'
          textField='text' idField='id' groupIDField='groupId' startHourField='startHour' endHourField='endHour'>
        </e-resource>
      </e-resources>
      <e-views>
        <e-view option="TimelineDay" displayName="Day" [allowVirtualScrolling]="virtualScroll"></e-view>
        <e-view option="TimelineWeek" displayName="Week" [allowVirtualScrolling]="virtualScroll"></e-view>
        <!-- <e-view option="Month" displayName="Month"></e-view> -->
        <e-view option="Agenda"></e-view>
      </e-views>
    </ejs-schedule>
  <!-- </div> -->
</div>



There is the TypeScript code:

onPopupOpen(args: PopupOpenEventArgs): void {
    if (args.type === 'QuickInfo'{
      args.cancel = true;
      return;
    }
    const data: { [key: string]: Object } = <{ [key: string]: Object }>args.data;
    const target: HTMLElement = (args.type === 'RecurrenceAlert' ||
      args.type === 'DeleteAlert'? (args.data as any).element[0: args.target;

    if (args.type === 'Editor'{
      if (target && target.classList.contains('e-work-cells')) {
        if ((!this.scheduleObj.first.isSlotAvailable(data) || !target.classList.contains('e-work-hours'))) {
          args.cancel = true;
        }
      }

      let recurElement: HTMLElement = args.element.querySelector('#RecurrenceEditor');
            if (!recurElement.classList.contains('e-recurrenceeditor')) {
                let recurrObject: RecurrenceEditor = new RecurrenceEditor({
                });
                recurrObject.appendTo(recurElement);
                (this.scheduleObj.first.eventWindow as any).recurrenceEditor = recurrObject;
            }
            document.getElementById('RecurrenceEditor').style.display = (this.scheduleObj.first.currentAction == "EditOccurrence"? 'none' : 'block';
    }

    if (!args.cancel) {
      const customFn: (args: { [key: string]: string })
        => boolean = (args: { [key: string]: any }) => {
          if (args.element.name === 'StartTime' || args.element.name === 'EndTime'{
            return ((this.startTimePicker.last.value) < (this.endTimePicker.last.value));
          }
        };

      const options: FormValidatorModel = {
        rules: {
          'EntityId': {
            required: [true, 'Required']
          },
          'StartTime': {
            required: [true, 'Required'],
            range: [customFn, 'Start needs to be before End']
          },
          'EndTime': {
            required: [true, 'Required'],
            range: [customFn, 'End needs to be after Start']
          }
        },
        customPlacement: (inputElement: HTMLElement, errorElement: HTMLElement) => {
          inputElement.parentElement.parentElement.appendChild(errorElement);
        }
      }
      this.formObject = new FormValidator('#EditForm', options)
    }

  }


Hareesh Balasubramanian [Syncfusion]
Replied On December 10, 2019 12:48 PM UTC

Hi Alireza, 

Greetings from Syncfusion Support. 

Based on your requirement we have prepared a sample using editor template by importing RecurrenceEditor, which can be viewed from the following link, 
 
Kindly try the above sample, if you have any concerns please revert us back for further assistance. 

Regards, 
Hareesh 


Alireza Kahaei
Replied On December 11, 2019 02:59 PM UTC

Hi,

nice, that did the job but isn't there a way to do a two-way binding to a property like this.RecurrenceRule?

Br, Ali

Hareesh Balasubramanian [Syncfusion]
Replied On December 12, 2019 05:32 PM UTC

Hi Alireza, 

Thanks for your update. 

We regret to let you know that, there is no two way binding support for the RecurrenceRule option. 

Regards, 
Hareesh 


CONFIRMATION

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