onActionBegin not triggered with onPopupOpen with Angular Scheduler

In my application the "onActionBegin" function is for the firebase databse and it works. However when I add the function "onPopupOpen" the this onaction do not want to trigger. Nothing is saved to the database anymore. I have added the app.component.ts code, here i am simply trying to change the default duration from 30 mins to 60 mins for an event with the onPopupOpen function:


5 Replies

CH Chris August 9, 2021 03:50 PM UTC

//app.component.ts
@Component({
  selector: 'app-root',
  encapsulation: ViewEncapsulation.None,
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
  providers: [DragAndDropServiceDayServiceWeekServiceMonthServiceTimelineViewsServiceTimelineMonthService]
})
export class AppComponent {

  itemsany;
  public test;
  public currentView = "Week";
  public selectedDateDate = new Date(202184);
  public data;

  constructor(dbAngularFirestore) {
    this.data = db.collection('Data');
    this.items = db.collection('Data').valueChanges().subscribe(data => {
      this.items = data;
      this.test = data;
      let schObj = (document.querySelector('.e-schedule'as any).ej2_instances[0];
      let length = this.test.length;
      for (let i = 0i < lengthi++) {
        let endTime = this.test[i].EndTime.seconds.toString() + "000";
        let srtTime = this.test[i].StartTime.seconds.toString() + "000";
        this.test[i].StartTime = new Date(parseInt(srtTime));
        this.test[i].EndTime = new Date(parseInt(endTime));
      }
      schObj.eventSettings.dataSource = this.test;
    })
  }

  public onPopupOpen(argsany): void {
    if (args.type === 'Editor') {
      args.duration = 60;
  }
}

  
  public onActionBegin(argsany): void {

    if (args.requestType == "eventChange") {
      this.data.doc(args.changedRecords[0].DocumentId).update({ Subject: args.changedRecords[0].Subject });
      this.data.doc(args.changedRecords[0].DocumentId).update({ EndTime: args.changedRecords[0].EndTime });
      this.data.doc(args.changedRecords[0].DocumentId).update({ StartTime: args.changedRecords[0].StartTime });
      this.data.doc(args.changedRecords[0].DocumentId).update({ Location: args.changedRecords[0].Location });
      this.data.doc(args.changedRecords[0].DocumentId).update({ IsAllDay: args.changedRecords[0].IsAllDay });
      this.data.doc(args.changedRecords[0].DocumentId).update({ RecurrenceRule: args.changedRecords[0].RecurrenceRule });
    } else if (args.requestType == "eventCreate") {
      let guid = (this.GuidFun() + this.GuidFun() + "-" + this.GuidFun() + "-4" + this.GuidFun().substr(03) + "-" + this.GuidFun() + "-" + this.GuidFun() + this.GuidFun() + this.GuidFun()).toLowerCase();
      args.data[0].DocumentId = guid.toString();
      this.data.doc(guid).set(args.data[0]);
    } else if (args.requestType == "eventRemove") {
      this.data.doc(args.deletedRecords[0].DocumentId).delete();
    }
  }
  public GuidFun() {
    return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  }
}

//My HTML

<div class="container-fluid">
  <div class="row"
    <div class = 'card'>
      <div class = 'card-body'>
        <ejs-schedule width='100%' height='850px' [currentView]="currentView"   (actionBegin)="onActionBegin($event)" [selectedDate]="selectedDate">
          <e-views>  
            <e-view option='Day'></e-view>                
            <e-view option='Week'></e-view>
            <e-view option='Month'></e-view>
            <e-view option='TimelineDay'></e-view>
            <e-view option='TimelineMonth'></e-view>
          </e-views>
        </ejs-schedule>
      </div>
    </div>
  </div>
</div>



VD Vinitha Devi Murugan Syncfusion Team August 10, 2021 08:22 AM UTC

Hi Chris, 
 
Greetings from Syncfusion Support. 
 
We have validated your reported problem However when I add the function "onPopupOpen" the this onaction do not want to trigger. and tried to replicate it at our end by preparing sample with your shared code. But unfortunately, we are unable to replicate it. The actionBegin event trigged properly at our end during each CRUD actions. We have shared the working sample for your reference. 
 
 
 
 
Kindly try the above sample, if you still face the problem at your end, please share the following details to validate the problem further at our end. 
  • Whether this works fine when removed popupOpen event?
  • Whether this works fine when you have no customization within popupOpen event?
  • Share scheduler package version
  • Try to replicate the issue in a sample
 
 
Regards, 
Vinitha


CH Chris August 10, 2021 11:35 AM UTC

Hi there, thank you for the reply, much appreciated. I had a look at your sample code, it seems that even though the function triggered the data just was not being saved to the firestore database, which is entirely a different problem. However I have solved it, with the right data-bindings, thank you. HOWEVER: I seem to have another big issue that seems to be a bug, whenever I refresh the browser the overflow menu will show in the right top corner and the views will be stuck in there (Today, Month, Week etc), its the same menu used for mobile version except it looks different and also if I refresh the page sometimes it works sometimes it does not. I added a image:




As you can see i circled in red the area thats the problem. Here is what it looks like when I open that:


After refreshing the page a few times the correct views load:





CH Chris August 10, 2021 11:37 AM UTC

After refreshing the page a few times the correct views load:




VD Vinitha Devi Murugan Syncfusion Team August 11, 2021 11:59 AM UTC

Hi Chris 
 
Thanks for your update. 
 
We have validated your reported issue at our end, in the latest versions of angular Hot Module Replacement (HMR) support is added. Due to this support, the dynamic module has been reloading instead of page reload. So the component styles need to be referred within the component instead of global styles declaration. We have resolved the reported problem ‘toolbar items misaligned in the application end itself by referring styles within component. For example in the below sample, we have rendered scheduler in AppComponent, the styles should refer to app.component.css instead of styles.css. Please try the following code and sample.  
  
@import '../../node_modules/@syncfusion/ej2-base/styles/material.css';  
@import '../../node_modules/@syncfusion/ej2-buttons/styles/material.css';  
@import '../../node_modules/@syncfusion/ej2-calendars/styles/material.css';  
@import '../../node_modules/@syncfusion/ej2-dropdowns/styles/material.css';  
@import '../../node_modules/@syncfusion/ej2-inputs/styles/material.css';  
@import '../../node_modules/@syncfusion/ej2-navigations/styles/material.css';  
@import '../../node_modules/@syncfusion/ej2-popups/styles/material.css';  
@import '../../node_modules/@syncfusion/ej2-schedule/styles/material.css';  
  
  
Please let us know if you need any further assistance.  
 
Regards, 
Vinitha 


Loader.
Up arrow icon