Articles in this section

How to Adjust Appointment Rendering in React Scheduler Component?

This article explains how to Adjust Appointment Rendering in the React Scheduler Component. You can achieve your requirement of customizing appointment positioning in the Scheduler by utilizing the schedule eventRendered event. The eventRendered event triggers before each of the event getting rendered on the scheduler user interface. This event allows you to modify the rendering of appointments, enabling, you to adjust the top value as needed to meet your specific requirements.

Below is a code snippet and a sample that demonstrate how to implement this solution:



[index.js] 

const onEventRendered = (args) => {
        var dataGroupIndex = args.element.getAttribute('data-group-index');
        var correspondingTdElement = scheduleObj.current.element.querySelector('td[data-group-index="' + dataGroupIndex + '"]');
        if (correspondingTdElement) {
            args.element.style.top = correspondingTdElement.offsetTop + 'px';
        } 
    }

    return (<div className='schedule-control-section'>
            <div className='col-lg-12 control-section'>
                <div className='control-wrapper'>
                    <ScheduleComponent ref={scheduleObj} eventRendered ={onEventRendered} cssClass='timeline-resource-grouping' width='100%' height='650px' selectedDate={new Date(2023, 0, 4)} currentView='TimelineWeek' eventSettings={{ dataSource: data }} group={{ resources: ['Projects', 'Categories'] }}>
                        <ResourcesDirective>
                            <ResourceDirective field='TaskId' title='Category' name='Categories' allowMultiple={true} dataSource={categoryData} textField='text' idField='id' groupIDField='groupId' colorField='color'/>
                        </ResourcesDirective>
                        <ViewsDirective>
                            <ViewDirective option='TimelineDay'/>
                            <ViewDirective option='TimelineWeek'/>
                            <ViewDirective option='TimelineWorkWeek'/>
                            <ViewDirective option='TimelineMonth'/>
                            <ViewDirective option='Agenda'/>
                        </ViewsDirective>
                        <Inject services={[TimelineViews, TimelineMonth, Agenda, Resize, DragAndDrop]}/>
                    </ScheduleComponent>
                </div>
            </div>
        </div>);


Refer to the working sample for additional details and implementation: Sample 

 

Conclusion

We hope you enjoyed learning how to adjust appointment rendering in the React Scheduler component.

You can refer to our React Scheduler feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our React Scheduler Example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsBoldDesk Support, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied