Context Menu for Resources in the Scheduler

I am using the latest release, and I want to provide a context menu for the resources in the Scheduler. 

I am using the context menu for cells and events, but I can't find any examples of how to access the resource info from the context menu. 

Thank you


1 Reply

SK Satheesh Kumar Balasubramanian Syncfusion Team April 8, 2022 01:02 PM UTC

Hi Mike,

 

You can get the resource details using GetResourceByIndex method by passing GroupIndex.

 

Index.razor:

       public async Task OnOpen(BeforeOpenCloseMenuEventArgs<MenuItem> args)

    {

        if (args.ParentItem == null)

        {

            CellData = await ScheduleRef.GetTargetCellAsync((int)args.Left, (int)args.Top);

            if (CellData == null)

            {

                EventData = await ScheduleRef.GetTargetEventAsync((int)args.Left, (int)args.Top);

                if (EventData.Id == 0)

                {

                    args.Cancel = true;

                }

                if (EventData.RecurrenceRule != null)

                {

                    isCell = isEvent = true;

                    isRecurrence = false;

                }

                else

                {

                    isCell = isRecurrence = true;

                    isEvent = false;

                }

            }

            else

            {

                var resourceDetails = ScheduleRef.GetResourceByIndex(CellData.GroupIndex);

                isCell = false;

                isEvent = isRecurrence = true;

            }

        }

    }

 

 devenv_GKtxP3lxGD.png

 

devenv_XWX2LQ99Nj.png


Kindly try the attached sample and let us know if this works at your endIf you still face any problem, please share the below details to reproduce the issue which will help us to validate the issue and provide prompt solution as soon as possible.

  • Replicate the issue in attached sample or share simple issue replicating sample if possible
  • Share all schedule related code snippets

Regards,

Satheesh Kumar B



Loader.
Up arrow icon