1

I am working with the component on the link: https://ej2.syncfusion.com/angular/documentation/api/calendar/

I couldn't find any function or property that disables component state so I can't select dates on the calendar.

For this reason I would like to know if it is possible to remove the click event so that it cannot select dates in a given situation.

I can only disable the dates that he can't select, only that I can't display the selected dates that I manually entered in the schedule.

Is it possible to remove the event from the DOM so that it cannot perform any action on the component? How can I do this?

enter image description here

4
  • 2
    Can you not listen to the onChange event and check EmitType<ChangedEventArgs> == MouseEvent and then event.preventDefault()? ej2.syncfusion.com/angular/documentation/api/calendar/… Commented Sep 3, 2019 at 18:50
  • What exactly is the preventDefault() function for? This allows you to select the date anyway. Commented Sep 3, 2019 at 19:11
  • You can read more about it on MDN. I'd try that as a solution. developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault Commented Sep 3, 2019 at 19:12
  • If you want to disable click in gray dates (that already have a specific css classe), you can probably do it by css too. pointer-events: none; Commented Sep 3, 2019 at 20:33

2 Answers 2

1

You can disable click event by using css somehing like this

/deep/.calendar {
   pointer-events: none;
}

You need to add correct class or id of the element you want to disable click event

Sign up to request clarification or add additional context in comments.

Comments

0

You can use renderDayCell method to disable the required dates in syncfusion date picker component. Please check the below code block.

https://stackblitz.com/edit/angular-syz8gx?file=app.component.html

Here, we have disabled the week ends in the DatePicker popup. So, we could not select or click the dates.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.