We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Add drop-down to scheduler header

schedular header.png


I want to add drop-down and button to scheduler header.

Can I change the header to custom?

If possible, please let me know how to change it.


1 Reply

VR Vijay Ravi Syncfusion Team February 1, 2023 12:46 PM UTC

Hi TaeWook,


You can achieve your requirement with help of the actionBegin(Triggered before the toolbar rendering) and actionComplete(Triggered once the toolbar rendering is completed) events of the Schedule as shown in the below code snippet.


Demo: https://ej2.syncfusion.com/aspnetcore/Schedule/HeaderBar#/material


[Index.cshtml]

<ejs-schedule id="schedule" height="550" selectedDate="new DateTime(2018, 2, 15)" actionBegin="onActionBegin" actionComplete="onActionComplete">

    <e-schedule-eventsettings dataSource="@ViewBag.datasource"></e-schedule-eventsettings>

    <e-schedule-views>

        <e-schedule-view option="Month"></e-schedule-view>

        <e-schedule-view option="Week"></e-schedule-view>

    </e-schedule-views>

</ejs-schedule>

 

<script type="text/javascript">

    function onActionBegin(args) {

        if (args.requestType === 'toolbarItemRendering') {

            args.items[3].align = "Left";

            args.items[4].align = "Left";

            args.items[5].align = "Left";

            args.items[6].align = "Left";

            var UserDropdown = { template: '<input type="text" id="UserDropdown" />', type: 'Input', align: 'Right' }

            args.items.push(UserDropdown);

            var DisciplineDropdown = { template: '<input type="text" id="DisciplineDropdown" />', type: 'Input', align: 'Right' }

            args.items.push(DisciplineDropdown);

        }

    }

 

    function onActionComplete(args) {

        if (args.requestType === 'toolBarItemRendered') {

            var scheduleElement = document.getElementById('schedule');

            var dropdown = scheduleElement.querySelector('dropdown');

            let UserData = [

                { Id: 'User1', User: 'Badminton' },

                { Id: 'User2', User: 'Basketball' },

                { Id: 'User3', User: 'Cricket' },

            ];

 

            let DisciplineData = [

                { Id: 'Discipline1', Name: 'Discipline1' },

                { Id: 'Discipline2', Name: 'Discipline2' },

                { Id: 'Discipline3', Name: 'Discipline3' },

            ];

            var listObj = new ej.dropdowns.DropDownList({

                dataSource: UserData,

                fields: { value: 'User' },

                placeholder: "User"}

            );

            listObj.appendTo('#UserDropdown');

 

            var listObj1 = new ej.dropdowns.DropDownList({

                dataSource: DisciplineData,

                fields: { value: 'Name' },

                placeholder: "Discipline"}

            );

            listObj1.appendTo('#DisciplineDropdown');

        }

    }       

</script>

 


Regards,

Vijay Ravi


Attachment: actionBegin_d8af851.zip

Loader.
Live Chat Icon For mobile
Up arrow icon