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
close icon

Prevent event creation in same timeslot

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

5 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team 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 



GC Gerson C Teixeira 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.


KK Karthigeyan Krishnamurthi Syncfusion Team 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 



GC Gerson C Teixeira 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.


NR Nevitha Ravi Syncfusion Team 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 


Loader.
Live Chat Icon For mobile
Up arrow icon