I have two types of events on my scheduler. Booked events and not booked events. I want to display different editor templates for them like this
The editor template I want along with different header and footers are
The above is for the not booked event.
And this is for the not booked session.
How can I accomplish the same?
I am using React.js with functional components
This is my initial code
Basically, I want to show this modal if the session is booked.
You can have a different editor window based on the
appointment type by using the below code snippet.
Code snippet:
|
editorTemplate(props) { return ((props !== undefined) ? <EditorContent currentType={props} /> : <div></div>); } . . . class EditorContent extends React.Component { constructor() { super(...arguments); this.instance = new Internationalization(); } getTimeString(value) { return this.instance.formatDate(value, { skeleton: 'hm' }); } render() { return ( (this.props.currentType.EventType != "Booked") ? <table className="custom-event-editor" style={{ width: '100%', cellpadding: '5' }}><tbody> <tr><td className="e-textlabel">Summary</td><td style={{ colspan: '4' }}> <input id="Summary" className="e-field e-input" type="text" name="Subject" style={{ width: '100%' }} /> </td></tr> <tr><td className="e-textlabel">Reason</td><td style={{ colspan: '4' }}> <textarea id="Description" className="e-field e-input" name="Description" rows={3} cols={50} style={{ width: '100%', height: '60px !important', resize: 'vertical' }}></textarea> </td></tr></tbody></table> : <div> <div> { (this.props.currentType.Subject !== undefined) ? <div>{this.props.currentType.Subject}</div> : "" } { (this.props.currentType.StartTime !== undefined) ? <div>{this.getTimeString(this.props.currentType.StartTime)}</div> : "" } { (this.props.currentType.EndTime !== undefined) ? <div >{this.getTimeString(this.props.currentType.EndTime)}</div> : "" } </div> </div> ) } } |
Sample: https://stackblitz.com/edit/react-schedule-editor-template-numeric-textbox-8dmgjt?file=index.js
Kindly try the above solution and let us know if this is helpful
This would work if I don't want to change the footer button but as you can see in the screenshots I provided,
There are different buttons in the footer too. So how can I achieve that since the button of booked session needs to perform a different action too.
As we mentioned in our last reply. You can have a different
editor window based on the appointment type by using the below code snippet. Here
you need to form the editor window on your own and use it in the below-highlighted
code.
The Skyblue color code will open the editor window for the not-booked appointment type.
Here you can use the custom editor window as same as your screenshot
The green color code will open the editor window for booked appointment type. Here
you can use the custom editor window only having the Appointment details as same as your screenshot.
Code snippet:
|
editorTemplate(props) { return ((props !== undefined) ? <EditorContent currentType={props} /> : <div></div>); } . . . class EditorContent extends React.Component { constructor() { super(...arguments); this.instance = new Internationalization(); } getTimeString(value) { return this.instance.formatDate(value, { skeleton: 'hm' }); } render() { return ( (this.props.currentType.EventType != "Booked") ? <table className="custom-event-editor" style={{ width: '100%', cellpadding: '5' }}><tbody> <tr><td className="e-textlabel">Summary</td><td style={{ colspan: '4' }}> <input id="Summary" className="e-field e-input" type="text" name="Subject" style={{ width: '100%' }} /> </td></tr> <tr><td className="e-textlabel">Reason</td><td style={{ colspan: '4' }}> <textarea id="Description" className="e-field e-input" name="Description" rows={3} cols={50} style={{ width: '100%', height: '60px !important', resize: 'vertical' }}></textarea> </td></tr></tbody></table> : <div> <div> { (this.props.currentType.Subject !== undefined) ? <div>{this.props.currentType.Subject}</div> : "" } { (this.props.currentType.StartTime !== undefined) ? <div>{this.getTimeString(this.props.currentType.StartTime)}</div> : "" } { (this.props.currentType.EndTime !== undefined) ? <div >{this.getTimeString(this.props.currentType.EndTime)}</div> : "" } </div> </div> ) } } |
Kindly follow the above solution and change the editor template codes
based on your requirement. Let us know if you need further assistance.
As per the solution you provided,
This is the editorTemplate for booked event
And this is the template for not booked event
And what I actually want is along with the content (that has changed according to event type) I also want the header and footer of the modal to be changed as you can see I have marked. That is my main que
Please find the below sample to have different footer buttons.
https://stackblitz.com/edit/react-schedule-editor-template-numeric-textbox-w1xkow?file=index.js