Get syncfusion Schedule data on a specific cell in Blazor

570 Views Asked by At

I am new in SynFusion and Blazor. I read The Synfusion Document and I find myself in situation that I want to get the synfusion cell data and pass data in a Radzen dialogservice. First I have to get the Synfusion Scheduler cell Data . Which Event may I have get that?

For example ScheduleEvents OnCellClick I get Start Date and End Date.But I have to click the empty cell. Now if I click on a cell that have data and showing someone appointment I want to edit so I have to get the data for example I show in a picture of my sfschedule in below to explain:

enter image description here

If I click "Kevin sick 2 hours off" I could not get data and

<ScheduleEvents TValue="AppointmentData" OnPopupOpen="@OnPopupOpen" OnCellClick="OnCellClickAsync" >

I am talking about the OnCellClick .

<SfSchedule TValue="AppointmentData"   SelectedDateChanged="CommandDateChanged" Width="100%" Height="600px" EnableAutoRowHeight="true" SelectedDate="@DateTime.Now" DateFormat="yyyy/MM/dd" @bind-CurrentView="@CurrentView">
        
        <ScheduleResources>
            <ScheduleResource TItem="ResourceData" TValue="int" DataSource="@ProjectData" Field="Id" TextField="Text" ColorField="Color">

            </ScheduleResource>
        </ScheduleResources>
        <ScheduleEvents TValue="AppointmentData" OnPopupOpen="@OnPopupOpen" OnCellClick="OnCellClickAsync" > </SfSchedule>

And here is my OnCellClick of C#

 public async Task OnCellClickAsync(CellClickEventArgs args)
    {
      
        var parameters2 = new Dictionary<string, object>();
        parameters2.Add("StartDate", args.StartTime.Date.ToString());
        parameters2.Add("EndDate", args.StartTime.Date.ToString());
        var notificationMessage = new Radzen.NotificationMessage();
        notificationMessage.Severity = Radzen.NotificationSeverity.Success;
        notificationMessage.Duration = 4000;
    }

You can see on CellClickEventArgs I can get start date and end date of current cell. But that is only where there is no data. I want to update and that's why I want to get cell data. How can I get current cell data as per the picture I have shown?

1

There are 1 best solutions below

0
On

You can get the event details on OnEventClick event, please refer to the following UG. You can access your event details on Event. https://blazor.syncfusion.com/documentation/scheduler/events/#oneventclick

If you want to get the event details on OnCellClick event, you can use GetEvents method using which can can get all the events available in that cell.

    public async Task OnCellClick(CellClickEventArgs args)
    {
        args.Cancel = true;
        List<AppointmentData> events = await 
            ScheduleRef.GetEvents(args.StartTime, args.EndTime);
    }