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

Prevent event creation in same timeslot

Thread ID:

Created:

Updated:

Platform:

Replies:

145130 Jun 7,2019 06:56 PM UTC Jun 13,2019 07:34 AM UTC JavaScript - EJ 2 5
loading
Tags: Schedule
Gerson C Teixeira
Asked On June 7, 2019 06:56 PM UTC

Hi.
I would like to block/prevent the creation of new event on occuped timeslot (timeline view) through click in bottom them.
How can I do that?
I attached an image to show what I don't want.
Thank you.

Attachment: file_5680f17d.zip

Karthigeyan Krishnamurthi [Syncfusion]
Replied On June 10, 2019 06:31 AM UTC

Hi Gerson, 
 
Syncfusion greetings. 
 
We can achieve your requirement using isSlotAvailable method and kindly refer the below links. 
 
actionBegin: function (args) { 
    if (args.requestType === 'eventCreate' || args.requestType === 'eventChange') { 
      var data = void 0; 
      if (args.requestType === 'eventCreate') { 
        data = args.data[0]; 
      } 
      else if (args.requestType === 'eventChange') { 
        data = args.data; 
      } 
      var groupIndex = scheduleObj.eventBase.getGroupIndexFromEvent(data); 
      if (!scheduleObj.isSlotAvailable(data.StartTime, data.EndTime, groupIndex)) { 
        args.cancel = true; 
      } 
    } 
  } 
 
Regards, 
Karthi 


Gerson C Teixeira
Replied On June 11, 2019 12:14 PM UTC

Hi Karthi.

This code doesn't work for click in events. For drag n drop works great.
Follow these steps and you'll see:
1 Open up:
2 Click in any created event;
3 Close event clicking on X in top/right;
4 Click below of the event;
5 Just save.

An event will be created (+1 more) below of clicked event.

Can you check this out?

Thank you.

Karthigeyan Krishnamurthi [Syncfusion]
Replied On June 12, 2019 04:20 AM UTC

Hi Gerson, 
 
Thanks for the update. 
 
Kindly use the below code example to overcome the issue. 
 
actionBegin: function (args) { 
    if (args.requestType === 'eventCreate' || args.requestType === 'eventChange') { 
      var data = void 0; 
      if (args.requestType === 'eventCreate') { 
        data = args.data[0]; 
      } 
      else if (args.requestType === 'eventChange') { 
        data = args.data; 
      } 
      var groupIndex = scheduleObj.eventBase.getGroupIndexFromEvent(data); 
      if (!scheduleObj.isSlotAvailable(data)) { 
        args.cancel = true; 
      } 
    } 
  } 
 
Regards, 
Karthi 


Gerson C Teixeira
Replied On June 12, 2019 02:08 PM UTC

Hi Karthi.

This would solve my problem, but when I try it into my code it doesn't work. The stackBlitz work great, but for me no. Maybe my js files are not in same version like yours? I tried to update for lastest version but with no success too. The version of ej.min.js in stackBlitz is final .51 and my version is final .47, I check out release notes and from 47 to 51 exists some fix to schedule comp. Maybe can be that?

I don't know what I can do. Can you, maybe, test this code in version .47? Or tell me how to get the lastest version outside syncfusion control panel?

Another last thing ... Is there a chance of that bottom space, below of event, disappear?  I don't find how in documentation.

Thank you.

Nevitha Ravi [Syncfusion]
Replied On June 13, 2019 07:34 AM UTC

Hi Gerson, 

Thanks for your update. 

We have checked our previously shared sample with the version 17.1.47 by changing the CDN link and it works fine at our end. We have shared the sample in the following link for your reference. 

Please check the sample if the issue persist still try to reproduce in a sample or share us the code snippets and issue details to check further on this. 

Q: Is there a chance of that bottom space, below of event, disappear? 
We suspect that your requirement is to customize the events which can be achieved either by using event template or eventRendered property. Please refer the following UG link. 

If we misunderstood your query or if you need any further assistance, please revert us with more details which depicts your requirement. 
 
Regards, 
Nevitha 


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