SortBy exists or not?

@using Syncfusion.Blazor.Schedule

<SfSchedule TValue="AppointmentSortData" Width="100%" EnableAutoRowHeight="true" @bind-SelectedDate="@CurrentDate" @bind-CurrentView="@SelectedView">
    <ScheduleEventSettings SortBy="RankId" DataSource="@DataSource"></ScheduleEventSettings>
    <ScheduleViews>
        <ScheduleView Option="View.Day"></ScheduleView>
        <ScheduleView Option="View.Week"></ScheduleView>
        <ScheduleView Option="View.WorkWeek"></ScheduleView>
        <ScheduleView Option="View.Month"></ScheduleView>
        <ScheduleView Option="View.TimelineDay"></ScheduleView>
        <ScheduleView Option="View.TimelineWeek"></ScheduleView>
        <ScheduleView Option="View.TimelineWorkWeek"></ScheduleView>
        <ScheduleView Option="View.TimelineMonth"></ScheduleView>
    </ScheduleViews>
</SfSchedule>

@code{
    DateTime CurrentDate = new DateTime(2020, 2, 14);
    View SelectedView = View.Week;
    DataSource = new List<AppointmentSortData>
    {
        new AppointmentSortData { Id = 1, Subject = "Rank A", RankId="A", StartTime = new DateTime(2020, 2, 13, 10, 0, 0) , EndTime = new DateTime(2020, 2, 13, 12, 0, 0) },
        new AppointmentSortData { Id = 2, Subject = "Rank B", RankId="B", StartTime = new DateTime(2020, 2, 13, 7, 0, 0) , EndTime = new DateTime(2020, 2, 13, 15, 0, 0) },
        new AppointmentSortData { Id = 3, Subject = "Rank C", RankId="C", StartTime = new DateTime(2020, 2, 13, 9, 0, 0) , EndTime = new DateTime(2020, 2, 13, 10, 30, 0) },
        new AppointmentSortData { Id = 4, Subject = "Rank D", RankId="D", StartTime = new DateTime(2020, 2, 13, 9, 30, 0) , EndTime = new DateTime(2020, 2, 13, 14, 0, 0) }
    };
    public class AppointmentSortData
    {
        public int Id { get; set; }
        public string Subject { get; set; }
        public string Location { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
        public string Description { get; set; }
        public bool IsAllDay { get; set; }
        public string RecurrenceRule { get; set; }
        public string RecurrenceException { get; set; }
        public Nullable<int> RecurrenceID { get; set; }
        public string RankId { get; set; }
    }
}

This code, lets call it code A, is directly copied from https://blazor.syncfusion.com/documentation/scheduler/appointments. It has the SortBy field. This code for some reason does not work, so I changed to use code B, which is an example exactly on top of code A in the documentation page. I twisted code B by adding the SortBy function:

@using Syncfusion.Blazor.Schedule

<SfSchedule TValue="AppointmentData" Height="550px" @bind-SelectedDate="@CurrentDate">
    <ScheduleEventSettings SortBy="Priority" DataSource="@DataSource">
    </ScheduleEventSettings>
    <ScheduleViews>
        <ScheduleView Option="View.Day"></ScheduleView>
        <ScheduleView Option="View.Week"></ScheduleView>
        <ScheduleView Option="View.WorkWeek"></ScheduleView>
        <ScheduleView Option="View.Month"></ScheduleView>
        <ScheduleView Option="View.Agenda"></ScheduleView>
    </ScheduleViews>
</SfSchedule>

@code{
    DateTime CurrentDate = new DateTime(2020, 1, 31);
    List<AppointmentData> DataSource = new List<AppointmentData>
    {
        new AppointmentData { Id = 1, Subject = "Meeting", StartTime = new DateTime(2020, 1, 31, 9, 30, 0) , EndTime = new DateTime(2020, 1, 31, 11, 0, 0),
        Status = "Completed", Priority = "High"}
    };
    public class AppointmentData
    {
        public int Id { get; set; }
        public string Subject { get; set; }
        public string Location { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
        public string Description { get; set; }
        public bool IsAllDay { get; set; }
        public string RecurrenceRule { get; set; }
        public string RecurrenceException { get; set; }
        public Nullable<int> RecurrenceID { get; set; }
        public string Status { get; set; }
        public string Priority { get; set; }
    }
}

Strangely, I got an error complaining that SortBy does not exist. Is there any correct way to do SortBy?


3 Replies 1 reply marked as answer

SK Satheesh Kumar Balasubramanian Syncfusion Team November 9, 2021 01:16 PM UTC

Hi Desmond,

Thanks for using Syncfusion Products.

We have validated your reported query "I got an error complaining that SortBy does not exist. Is there any correct way to do SortBy?" based on your shared snippets and prepared sample to reproduce the reported issue. But, we were unable to reproduce the reported issue.


Could you please share the below details to reproduce the issue? This will help to validate the issue and provide prompt solution at earliest.   
  • Replicate the issue in above sample or share issue replicating sample if possible
  • Share Syncfusion Nuget version

Regards,
Satheesh Kumar B



DE desmond replied to Satheesh Kumar Balasubramanian November 9, 2021 02:42 PM UTC

Thanks a lot for the prompt reply, I found out that I was using a wrong Blazor version. After using the latest Syncfusion Blazor, the problem disappeared.


Marked as answer

VM Vengatesh Maniraj Syncfusion Team November 10, 2021 06:36 AM UTC

Hi Desmond, 

Thanks for the update. 

We are happy that your problem has been resolved now. 

Please get back to us if you need any further assistance.  

Regards, 
Vengatesh  


Loader.
Up arrow icon