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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Block schedule time

Thread ID:

Created:

Updated:

Platform:

Replies:

143632 Mar 29,2019 01:26 PM UTC Apr 3,2019 08:23 AM UTC JavaScript - EJ 2 5
loading
Tags: Schedule
S_Line
Asked On March 29, 2019 01:26 PM UTC

Can i block the past schedule time or block some schedule's time for anyone click on?

Karthigeyan Krishnamurthi [Syncfusion]
Replied On April 1, 2019 09:17 AM UTC

Dear Customer, 
 
Greeting from Syncfusion. 
 
We have prepared the below sample to prevent the CRUD actions in the past time cells. 

eventRendered: function (args) { 
    if (new Date() - new Date(args.data.StartTime) > 0) { 
      args.data.IsReadonly = true 
      args.element.setAttribute('aria-readonly', 'true'); 
      args.element.classList.add('e-read-only'); 
    } 
  }, 
  dragStop: function (args) { 
    if (new Date() - new Date(args.data.StartTime) > 0) { 
      args.cancel = true; 
    } 
  }, 
  resizeStop: function (args) { 
    if (new Date() - new Date(args.data.StartTime) > 0) { 
      args.cancel = true; 
    } 
  }, 
  popupOpen: function (args) { 
    if (new Date() - new Date(args.data.startTime) > 0) { 
      args.cancel = true; 
    } 
  }, 
  actionBegin: function (args) { 
    if (args.requestType == 'eventCreate' || args.requestType == 'eventDelete' || args.requestType == 'eventChange') { 
      let data = (args.requestType == 'eventCreate') ? args.data[0] : args.data; 
      if (new Date() - new Date(data.StartTime) > 0) { 
        args.cancel = true; 
      } 
    } 
  } 
 
 
Regards, 
Karthi 
 


S_Line
Replied On April 1, 2019 11:46 AM UTC

Thank's for the answer, but, i need to block only the past time, and not the past event. Can i write some text to inform that "this time is blocked"?


Karthigeyan Krishnamurthi [Syncfusion]
Replied On April 2, 2019 11:28 AM UTC

Dear Customer,   
 
Thanks for your update. 
 
We modified our previous sample to make only the past time cells as read-only and also displayed custom text with custom color using renderCell and cellTemplate options. 

cellTemplate: '<div class="templatewrap">${getCellContent(data.date)}</div>', 
 
renderCell: function(args) { 
        if (args.element.classList.contains('e-work-hours') || args.element.classList.contains('e-work-cells')) { 
          if (args.date.getTime() < new Date().getTime()) { 
            args.element.classList.add('custom'); 
          } 
        } 
    } 
 
.custom { 
              background-color: #babebd !important; 
            } 
 
.e-schedule .e-vertical-view .e-all-day-cells .templatewrap { 
              display: none !important; 
            } 
 
 
Regards, 
Karthi 


S_Line
Replied On April 2, 2019 02:04 PM UTC

Ok, thank you! Helped me!!

Nevitha Ravi [Syncfusion]
Replied On April 3, 2019 08:23 AM UTC

Dear Customer, 
  
We are glad that our solution meets your requirement and please let us know if you need any further assistance. 
  
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

;