Wed 17. It is difficult because this is a wrapper and it's hard to access to each element contained in the wrapper. Any help?My render() looks like below and I don't see where I can do this (accessing each cell)
return (
<div>
<h2 style={{ marginBottom: '1.25em', marginTop: '1.25em', textAlign: 'center' }}>Your Schedule</h2>
<MuiThemeProvider theme={theme}>
<Paper>
<Scheduler data={data}>
<ViewState currentDate={currentDate} />
<EditingState onCommitChanges={this.commitChanges} />
<WeekView startDayHour={9} endDayHour={19} />
<Appointments />
<AppointmentTooltip
showOpenButton
showDeleteButton
/>
<AppointmentForm />
</Scheduler>
</Paper>
</MuiThemeProvider>
</div>
);
Hi @whyjay17,
The DevExtreme React Scheduler is not a wrapper. This is a pure react component, and you can have access to each UI element. Our Fundamentals guide describes what default visual templates exist and how to override them.
In your case, you should override the DayScaleCell template of the WeekView plugin and pass the onClick property into it. See the following example.
@MaximKudriavtsev Thank you so much! This is what I wanted exactly. Using the same idea, would it also be possible to make a specific appointment have a different color?
@whyjay17
All our UI plugins have a few default templates that you can customize. Please see the list of default templates in the plugin's API reference page.
The following demo demonstrates how to change an appointment appearance. You can also see it in this demo.
Thanks again, @MaximKudriavtsev.
I was aware that it is possible to change the color of all appointments. In my app, I am trying to add an appointment that has a different color from others. I was thinking to assign a class for this appointment to have a different color, but I wasn't sure how to assign class only to the specific appointment.
I really appreciate your help!
@whyjay17
You should use appointment metadata to recognize what class is needed in your custom template. See the following demo.
@MaximKudriavtsev Thanks again, sir! I am trying to add a new appointment by adding a new object to the schedule state that I have in my component. Whenever it gets added, it re-renders the calendar component. However, I am not sure how I am supposed to set a different className just for that component that got added to the state.
@whyjay17
Update of a component's state causes re-rendering it, it's expected behavior. You can specify initial data with a specific field, which value may affect adding a specific className in the Appointment component, as I did聽in the example above.
Hey there @MaximKudriavtsev, I was playing around with the library and am having some issues customising the dates on the top of the calendar.
Hi @AngelineLim,
I am afraid your requirements are unclear. Please describe the problem in greater detail and use images or examples to illustrate what behavior you want to achieve. I kindly ask you to create a separate ticket not to mix different issues within one thread.
@MaximKudriavtsev This fixed my issue! Thank you so much!
This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests.