Skip to content

Commit db44b16

Browse files
chore(scheduler): simplify example
1 parent 84aa919 commit db44b16

File tree

1 file changed

+31
-28
lines changed
  • components/scheduler/appointments

1 file changed

+31
-28
lines changed

components/scheduler/appointments/edit.md

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,11 @@ The example below shows the signature of the event handlers so you can copy the
7878
OnDelete="@DeleteAppointment"
7979
OnEdit="@EditHandler" OnCancel="@CancelHandler"
8080
AllowCreate="true" AllowDelete="true" AllowUpdate="true"
81-
@bind-Date="@StartDate" Height="600px" @bind-View="@CurrView"
82-
StartField="@(nameof(SchedulerAppointment.StartTime))"
83-
EndField="@(nameof(SchedulerAppointment.EndTime))"
84-
TitleField="@(nameof(SchedulerAppointment.Title))"
85-
DescriptionField="@(nameof(SchedulerAppointment.Description))"
86-
IsAllDayField="@(nameof(SchedulerAppointment.IsAllDay))">
81+
@bind-Date="@StartDate" Height="600px" @bind-View="@CurrView">
8782
<SchedulerViews>
88-
<SchedulerDayView StartTime="@DayStart" EndTime="@DayEnd" WorkDayStart="@WorkDayStart" WorkDayEnd="@WorkDayEnd" />
89-
<SchedulerWeekView StartTime="@DayStart" EndTime="@DayEnd" WorkDayStart="@WorkDayStart" WorkDayEnd="@WorkDayEnd" />
90-
<SchedulerMultiDayView StartTime="@DayStart" EndTime="@DayEnd" WorkDayStart="@WorkDayStart" WorkDayEnd="@WorkDayEnd" NumberOfDays="10" />
83+
<SchedulerDayView StartTime="@DayStart" />
84+
<SchedulerWeekView StartTime="@DayStart" />
85+
<SchedulerMultiDayView StartTime="@DayStart" NumberOfDays="10" />
9186
</SchedulerViews>
9287
</TelerikScheduler>
9388
@@ -102,8 +97,8 @@ The example below shows the signature of the event handlers so you can copy the
10297
{
10398
matchingItem.Title = item.Title;
10499
matchingItem.Description = item.Description;
105-
matchingItem.StartTime = item.StartTime;
106-
matchingItem.EndTime = item.EndTime;
100+
matchingItem.Start = item.Start;
101+
matchingItem.End = item.End;
107102
matchingItem.IsAllDay = item.IsAllDay;
108103
}
109104
@@ -141,8 +136,8 @@ The example below shows the signature of the event handlers so you can copy the
141136
else
142137
{
143138
// get the time range of the slot the user clicked to add an appointment
144-
DateTime slotStart = item.StartTime;
145-
DateTime slotEnd = item.EndTime;
139+
DateTime slotStart = item.Start;
140+
DateTime slotEnd = item.End;
146141
}
147142
}
148143
@@ -154,48 +149,56 @@ The example below shows the signature of the event handlers so you can copy the
154149
}
155150
156151
// sample data and scheduler settings
157-
public DateTime StartDate { get; set; } = new DateTime(2019, 11, 29);
158152
public SchedulerView CurrView { get; set; } = SchedulerView.Week;
159-
//the time portions are important
160-
public DateTime DayStart { get; set; } = new DateTime(2000, 1, 1, 8, 0, 0);
161-
public DateTime DayEnd { get; set; } = new DateTime(2000, 1, 1, 20, 0, 0);
162-
public DateTime WorkDayStart { get; set; } = new DateTime(2000, 1, 1, 9, 0, 0);
163-
public DateTime WorkDayEnd { get; set; } = new DateTime(2000, 1, 1, 17, 0, 0);
153+
public DateTime StartDate { get; set; } = new DateTime(2019, 12, 2);
154+
public DateTime DayStart { get; set; } = new DateTime(2000, 1, 1, 8, 0, 0); //the time portion is important
164155
List<SchedulerAppointment> Appointments = new List<SchedulerAppointment>()
165156
{
166157
new SchedulerAppointment
167158
{
159+
Id = Guid.NewGuid(),
160+
Title = "Board meeting",
161+
Description = "Q4 is coming to a close, review the details.",
162+
Start = new DateTime(2019, 12, 5, 10, 00, 0),
163+
End = new DateTime(2019, 12, 5, 11, 30, 0)
164+
},
165+
166+
new SchedulerAppointment
167+
{
168+
Id = Guid.NewGuid(),
168169
Title = "Vet visit",
169170
Description = "The cat needs vaccinations and her teeth checked.",
170-
StartTime = new DateTime(2019, 11, 26, 11, 30, 0),
171-
EndTime = new DateTime(2019, 11, 26, 12, 0, 0)
171+
Start = new DateTime(2019, 12, 2, 11, 30, 0),
172+
End = new DateTime(2019, 12, 2, 12, 0, 0)
172173
},
173174
174175
new SchedulerAppointment
175176
{
177+
Id = Guid.NewGuid(),
176178
Title = "Planning meeting",
177179
Description = "Kick off the new project.",
178-
StartTime = new DateTime(2019, 11, 25, 9, 30, 0),
179-
EndTime = new DateTime(2019, 11, 25, 12, 45, 0)
180+
Start = new DateTime(2019, 12, 6, 9, 30, 0),
181+
End = new DateTime(2019, 12, 6, 12, 45, 0)
180182
},
181183
182184
new SchedulerAppointment
183185
{
186+
Id = Guid.NewGuid(),
184187
Title = "Trip to Hawaii",
185188
Description = "An unforgettable holiday!",
186189
IsAllDay = true,
187-
StartTime = new DateTime(2019, 11, 27),
188-
EndTime = new DateTime(2019, 12, 07)
190+
Start = new DateTime(2019, 11, 27),
191+
End = new DateTime(2019, 12, 05)
189192
}
190193
};
191194
192195
public class SchedulerAppointment
193196
{
194-
public int Id { get; set; }
197+
public Guid Id { get; set; }
195198
public string Title { get; set; }
196199
public string Description { get; set; }
197-
public DateTime StartTime { get; set; }
198-
public DateTime EndTime { get; set; }
200+
public DateTime Start { get; set; }
201+
public DateTime End { get; set; }
199202
public bool IsAllDay { get; set; }
200203
}
201204
}

0 commit comments

Comments
 (0)