SfSchedule databind from database is not working

Hi,

I am binding the schedule data from database.  while debugging the code, i m seeing the GetScheduleData() method returning the data from database. But it is not binding in schedule control. while giving hardcode value in that method  like this

new AppointmentData { Id = 1,  StartTime = new DateTime(2020, 3, 10, 9, 30, 0) , EndTime = new DateTime(2020, 3, 10, 12, 0, 0) }

It is binding in schedular control.

My complete code snippet is like given below. could you please let me know, where am i doing mistake ?

<SfSchedule TValue="AppointmentData" Width="900px" Height="700px" AllowDragAndDrop="true"
                            EnableAutoRowHeight="true" ShowQuickInfo="false"
                            @bind-CurrentView="CurrentView">
                    <ScheduleViews>
                        <ScheduleView Option="View.Day" StartHour="07:00" EndHour="19:00"></ScheduleView>
                        <ScheduleView Option="View.Week" StartHour="07:00" EndHour="19:00"></ScheduleView>
                        <ScheduleView Option="View.Month" ShowWeekend="true"></ScheduleView>
                        <ScheduleView Option="View.TimelineDay" StartHour="07:00" EndHour="19:00"></ScheduleView>
                    </ScheduleViews>
                    <ScheduleEvents TValue="AppointmentData" ></ScheduleEvents>

                    <ScheduleGroup Resources="@Resources"></ScheduleGroup>
                    <ScheduleResources>
                        <ScheduleResource TItem="ResourceData" TValue="int" DataSource="@RoomData()"
                                          Field="Id" Title="Room" Name="Rooms"
                                          TextField="RoomText" IdField="Id" AllowMultiple="false">

                        </ScheduleResource>
                    </ScheduleResources>
                   
                    <ScheduleEventSettings DataSource="@GetScheduleData()" EnableTooltip="@EnableTooltip">
                        <TooltipTemplate>
                            @{
                                var eventData = (context as AppointmentData);

                                <div class="tooltip-wrap">
                                    <div class="content-area">
                                        @eventData.Subject
                                        <div>Tech: @eventData.TechName</div>
                                        <div>Customer: @eventData.Customer</div>
                                        <div>Location: @eventData.Location</div>
                                        <div>Vehicle: @eventData.VehicleName</div>
                                        From : @eventData.StartTime
                                        To  : @eventData.EndTime
                                    </div>
                                </div>
                            }
                        </TooltipTemplate>
                    </ScheduleEventSettings>
                </SfSchedule>
------------------------------------------------------------------------------------------
public List<AppointmentData> GetScheduleData()
    {
        var appData = new List<AppointmentData>();
        appData = ScheduleService.GetAllAppointmentData();
        return appData;
    }

public List<ResourceData> RoomData()
    {
        var roomData = new List<ResourceData>();
        roomData = ScheduleService.GetAllResourceData();
        return roomData;
    }

    public List<WaitData> GetWaitList()
    {
        var wData = new List<WaitData>();
        wData = ScheduleService.GetAllWaitData();
        return wData;
    }

    public List<RepairBays> GetLocationList()
    {
        var locationlist = new List<RepairBays>();
        locationlist = ScheduleService.GetAllLocationData();
        return locationlist;
    }


2 Replies 1 reply marked as answer

CH chandradev March 10, 2021 04:42 PM UTC

Hi 

I fixed the issue, there was problem with ScheduleResource  mapping .

But i m getting one more issue. After saving appointment in database some time screen is not getting refresh. At time i m not mouse hover text and drag and drop is not working. Could you give me syntax for screen refresh ?


RV Ravikumar Venkatesan Syncfusion Team March 11, 2021 07:28 AM UTC

Hi Chandradev, 

Greetings from Syncfusion support, we are happy that you have resolved your previously shared problem. 

We have validated your reported problem “After saving appointment in the database some time screen is not getting refresh” at our end and suggest you to try the Blazor lifecycle method StateHasChanged or RefreshEvents method of Schedule once the data updated to the DB. 

Kindly try the above solution and if you still facing the same problem kindly share the below details to serve you better. 
  • Share the details of how you updating the data to the DB with the code snippet or
  • Share a video demo that illustrates your reported problem or
  • Share a simple sample that illustrates the problem with replication steps which would help us to proceed further.


Regards, 
Ravikumar Venkatesan 


Marked as answer
Loader.
Up arrow icon