Skip to content

Commit 1c9ce80

Browse files
chore(scheduler): simplify first look sample
1 parent 48d314c commit 1c9ce80

File tree

3 files changed

+22
-26
lines changed

3 files changed

+22
-26
lines changed

components/scheduler/appointments/overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The appointment model needs to provide the fields from the list below that are u
1818
1919
>caption Appointment fields
2020
21+
* `Id` - (`Guid`) - the unique identifier for the appointment.
2122
* `Title` - (`string`) - this is what is shown in the main scheduler view so the user can identify the event.
2223
* `Start` - (`DateTime`) - the date and time at which the appointment starts.
2324
* `End` - (`DateTime`) - the date and time at which the appointment ends.
-361 Bytes
Loading

components/scheduler/overview.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,69 +16,63 @@ To use a Telerik Scheduler for Blazor
1616

1717
1. Add the `TelerikScheduler` tag.
1818
1. Populate its `Data` property with the collection of appointments/events the user needs to see. See the [Appointments Overview]({%slug scheduler-appointments-overview%}) article for details on the needed fields.
19-
1. Set the `TitleField`, `StartField`, `EndField`, `DescriptionField` and `IsAllDayField` properties to point to the corresponding names of the model.
20-
1. Define the Views the user can toggle between in the `SchedulerViews` collection. Optionally, set their settings such as days start and end.
19+
1. Define the Views the user can toggle between in the `SchedulerViews` collection. Optionally, set their settings (such as days start and end) and choose a default View.
2120

2221
>caption Scheduler first look and main features
2322
2423
````CSHTML
25-
@* Fewer settings are required to get the component running, but you will usually have to set these for better UX *@
26-
27-
<TelerikScheduler Data="@Appointments" @bind-Date="@StartDate" Height="600px" @bind-View="@CurrView"
28-
StartField="@(nameof(SchedulerAppointment.StartTime))"
29-
EndField="@(nameof(SchedulerAppointment.EndTime))"
30-
TitleField="@(nameof(SchedulerAppointment.Title))"
31-
DescriptionField="@(nameof(SchedulerAppointment.Description))"
32-
IsAllDayField="@(nameof(SchedulerAppointment.IsAllDay))">
24+
@* Fewer settings are required to get the component running, but you will usually have to set some for better UX *@
25+
26+
<TelerikScheduler Data="@Appointments" @bind-Date="@StartDate" @bind-View="@CurrView" Height="600px" Width="800px">
3327
<SchedulerViews>
34-
<SchedulerDayView StartTime="@DayStart" EndTime="@DayEnd" WorkDayStart="@WorkDayStart" WorkDayEnd="@WorkDayEnd" />
35-
<SchedulerWeekView StartTime="@DayStart" EndTime="@DayEnd" WorkDayStart="@WorkDayStart" WorkDayEnd="@WorkDayEnd" />
36-
<SchedulerMultiDayView StartTime="@DayStart" EndTime="@DayEnd" WorkDayStart="@WorkDayStart" WorkDayEnd="@WorkDayEnd" NumberOfDays="10" />
28+
<SchedulerDayView StartTime="@DayStart" />
29+
<SchedulerWeekView StartTime="@DayStart" />
30+
<SchedulerMultiDayView StartTime="@DayStart" NumberOfDays="10" />
3731
</SchedulerViews>
3832
</TelerikScheduler>
3933
4034
@code {
4135
public DateTime StartDate { get; set; } = new DateTime(2019, 11, 29);
4236
public SchedulerView CurrView { get; set; } = SchedulerView.Week;
43-
//the time portions are important
44-
public DateTime DayStart { get; set; } = new DateTime(2000, 1, 1, 8, 0, 0);
45-
public DateTime DayEnd { get; set; } = new DateTime(2000, 1, 1, 20, 0, 0);
46-
public DateTime WorkDayStart { get; set; } = new DateTime(2000, 1, 1, 9, 0, 0);
47-
public DateTime WorkDayEnd { get; set; } = new DateTime(2000, 1, 1, 17, 0, 0);
37+
public DateTime DayStart { get; set; } = new DateTime(2000, 1, 1, 8, 0, 0);//the time portion is important
4838
List<SchedulerAppointment> Appointments = new List<SchedulerAppointment>()
4939
{
5040
new SchedulerAppointment
5141
{
42+
Id = Guid.NewGuid(),
5243
Title = "Vet visit",
5344
Description = "The cat needs vaccinations and her teeth checked.",
54-
StartTime = new DateTime(2019, 11, 26, 11, 30, 0),
55-
EndTime = new DateTime(2019, 11, 26, 12, 0, 0)
45+
Start = new DateTime(2019, 11, 26, 11, 30, 0),
46+
End = new DateTime(2019, 11, 26, 12, 0, 0)
5647
},
5748
5849
new SchedulerAppointment
5950
{
51+
Id = Guid.NewGuid(),
6052
Title = "Planning meeting",
6153
Description = "Kick off the new project.",
62-
StartTime = new DateTime(2019, 11, 25, 9, 30, 0),
63-
EndTime = new DateTime(2019, 11, 25, 12, 45, 0)
54+
Start = new DateTime(2019, 11, 25, 9, 30, 0),
55+
End = new DateTime(2019, 11, 25, 12, 45, 0)
6456
},
6557
6658
new SchedulerAppointment
6759
{
60+
Id = Guid.NewGuid(),
6861
Title = "Trip to Hawaii",
6962
Description = "An unforgettable holiday!",
7063
IsAllDay = true,
71-
StartTime = new DateTime(2019, 11, 27),
72-
EndTime = new DateTime(2019, 12, 07)
64+
Start = new DateTime(2019, 11, 27),
65+
End = new DateTime(2019, 12, 07)
7366
}
7467
};
7568
7669
public class SchedulerAppointment
7770
{
71+
public Guid Id { get; set; }
7872
public string Title { get; set; }
7973
public string Description { get; set; }
80-
public DateTime StartTime { get; set; }
81-
public DateTime EndTime { get; set; }
74+
public DateTime Start { get; set; }
75+
public DateTime End { get; set; }
8276
public bool IsAllDay { get; set; }
8377
}
8478
}
@@ -108,6 +102,7 @@ The Scheduler is a generic component and its type is determined by the type of t
108102
109103
public class SchedulerAppointment
110104
{
105+
public Guid Id { get; set; }
111106
public string Title { get; set; }
112107
public string Description { get; set; }
113108
public DateTime StartTime { get; set; }

0 commit comments

Comments
 (0)