Discuss anything related to web development but no technical support questions


Post by lxxrxns »

Hi tasnim,

I guess that could work, but I'm not sure how to set the startDate and endDate to the date that the context menu was opened on.
Also, since I'm using an eventStore in a MySQL database, would I risk creating empty events when people don't click "Delete" since it's no longer a "new" event but an "existing" event that they're editing?

Is there no other way to trigger opening the event editor for a new event, just like the scheduleMenu's option "addEvent" does it?

Thanks again so much for your time and help!

Laurens


Post by marcio »

Hey Laurens,

As it's an old version of our suite, we don't provide full support, but if you could share a sample project with your configuration, we could try to debug and assist you on this.

You can also try to add a debugger and inspect which function is called for the addEvent menu and from there has a start point for your implementation.

But the recommendation would be to definitely upgrade to the latest version.

Best regards,
Márcio


Post by lxxrxns »

Managed to get it working! Thanks a lot for all the help! I expected your suggestion to not behave correctly because it would instantly get added to my eventstore (SQL database), but in fact it does behave just like adding a new activity, the only difference being that the title bar shows "Edit event" in stead of "Insert event" (which is not a big deal).

eventMenu : {
  items : {
    addAnotherEvent : {
      text : 'Voeg activiteit toe',
      icon   : 'b-fa b-fa-fw b-fa-plus',
      cls    : 'b-separator',
      onItem(props) {
        const { source, resourceRecord, event } = props;
        const insertEvent = new EventModel({
          resourceId   : resourceRecord.id,
          startDate    : source.getDateFromDomEvent(event),
          duration     : 1,
          durationUnit : 'h',
          name         : 'New activity'
        });
        scheduler.editEvent(insertEvent);
      }
    }
  }
}

Post by tasnim »

Awesome! Glad to hear that you've managed to get it working.

Good Luck 👍


Post Reply