This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdisabled.tsx
More file actions
41 lines (38 loc) · 1.69 KB
/
disabled.tsx
File metadata and controls
41 lines (38 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { DatePickerComponent, RenderDayCellEventArgs } from '@syncfusion/ej2-react-calendars';
import { SampleBase } from '../common/sample-base';
import './datepicker-component.css';
export class Disabled extends SampleBase<{}, {}> {
public disabledDate(args: RenderDayCellEventArgs): void {
if (args.date.getDay() === 0 || args.date.getDay() === 6) {
/*set 'true' to disable the weekends*/
args.isDisabled = true;
}
}
render() {
return (
<div className='control-pane'>
<div className='control-section'>
<div className='datepicker-control-section'>
<DatePickerComponent renderDayCell={this.disabledDate}></DatePickerComponent>
</div>
</div>
<div id="action-description">
<p>
In the following sample, all the weekends (Saturday and Sunday) of a month are <code>disabled</code>, and these dates are restricted to set or select in the DatePicker.
</p>
</div>
<div id='description'>
<p>
Disabled Dates sample demonstrates how to disable specific dates in the DatePicker by using <code>renderDayCell</code> event. This event gets triggered on each day cell element creation, that allows you to customize, or disable specific
dates in the DatePicker. Here the weekend dates are disabled by using renderDayCell.
</p>
<p>More information on the disabled dates can be found in the
<a href="https://ej2.syncfusion.com/react/documentation/datepicker/customization.html" target="_blank"> documentation section</a>.
</p>
</div>
</div>
)
}
}