Hello.
I'm using timelinewiew with resources (people) to develop a planning application. Purpose is to have "events" not assigned to a resource and by moving the event and dropping it on a resource's timeline assign it to that resource. The setup works fine, display of both events and resources works. The events are actually two classes of business objects that both derive from one class that exposes the Appointment attributes (start, end, subject etc.). Both types of events are supplied from database in generic lists. Resources too.
I have implemented the server-side method myScheduler_AppointmentUpdated with logic to update an event if it is dragged from one resource's timeline to another (and then setting the schedulers DataSource to an updated list of events). This seems to work, as at least sometimes when I move an event from one resource to another, the AppointmentUpdate event is fired. But, the event does not fire every time. I have tried to find a pattern for when the event fires and when not, but it seems random.
Not using any client-side stuff at all.
It seems I'm missing something basic here, which is probably correct as I'm a Telerik/scheduler noob :)
Anyone have any ideas?
Attached a screenshot of the timeline layout.
This is my scheduler:
And this is my code-behind:
Resource-types:
AppointmentUpdate-method:
I'm using timelinewiew with resources (people) to develop a planning application. Purpose is to have "events" not assigned to a resource and by moving the event and dropping it on a resource's timeline assign it to that resource. The setup works fine, display of both events and resources works. The events are actually two classes of business objects that both derive from one class that exposes the Appointment attributes (start, end, subject etc.). Both types of events are supplied from database in generic lists. Resources too.
I have implemented the server-side method myScheduler_AppointmentUpdated with logic to update an event if it is dragged from one resource's timeline to another (and then setting the schedulers DataSource to an updated list of events). This seems to work, as at least sometimes when I move an event from one resource to another, the AppointmentUpdate event is fired. But, the event does not fire every time. I have tried to find a pattern for when the event fires and when not, but it seems random.
Not using any client-side stuff at all.
It seems I'm missing something basic here, which is probably correct as I'm a Telerik/scheduler noob :)
Anyone have any ideas?
Attached a screenshot of the timeline layout.
This is my scheduler:
<
telerik:RadScheduler
ID
=
"schAbsences"
runat
=
"server"
HoursPanelTimeFormat
=
"HH:mm"
SelectedView
=
"TimelineView"
ShowViewTabs
=
"false"
ShowResourceHeaders
=
"true"
TimelineView-EnableExactTimeRendering
=
"true"
TimelineView-ShowDateHeaders
=
"true"
OnAppointmentDataBound
=
"schAbsences_AppointmentDataBound"
OnAppointmentDelete
=
"schAbsences_AppointmentDelete"
OnAppointmentUpdate
=
"schAbsences_AppointmentUpdate"
ColumnHeaderDateFormat
=
"h:mm"
FirstDayOfWeek
=
"Monday"
LastDayOfWeek
=
"Sunday"
ShowAllDayRow
=
"true"
ShowFooter
=
"true"
OverflowBehavior
=
"Expand"
OnNavigationComplete
=
"schAbsences_NavigationComplete"
>
<
TimelineView
NumberOfSlots
=
"24"
SlotDuration
=
"01:00:00"
TimeLabelSpan
=
"1"
ColumnHeaderDateFormat
=
"HH:mm tt"
/>
</
telerik:RadScheduler
>
Resource-types:
ResourceType rt = new ResourceType();
rt.Name = "Resources";
rt.ForeignKeyField = "ResourceId";
rt.KeyField = "Id";
rt.TextField = "FullName";
List<
Entities.Resource
> blapp = new List<
Entities.Resource
>();
blapp.AddRange(DBManager.GetExistingResources());
Entities.Resource r = new Entities.Resource();
r.firstName = "Inte";
r.lastName = "tillsatt";
r.Id = 0;
blapp.Insert(0, r);
rt.DataSource = blapp;
schAbsences.ResourceTypes.Add(rt);
DateTime startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
schAbsences.SelectedDate = startTime;
schAbsences.TimelineView.GroupBy = "Resources";
schAbsences.TimelineView.GroupingDirection = GroupingDirection.Vertical;
protected void schAbsences_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
{
String type = e.Appointment.Attributes["appointmentType"];
if (type.Equals("Absence"))
{
//Do update (use Attributes)
int origRsId = int.Parse(e.Appointment.Resources[0].Key.ToString());
}
else
{
int origResId = int.Parse(e.Appointment.Resources[0].Key.ToString());
int newResId = int.Parse(e.ModifiedAppointment.Resources[0].Key.ToString());
int appointmentId=int.Parse(e.Appointment.ID.ToString());
DBManager.UpdateMovedPlacementCompetence(appointmentId, newResId);
e.Cancel = true;
}
List<
BDEvent
> list = DBManager.GetAllAbsencesAsEvents();
list.AddRange(DBManager.GetAllPlacementCompetences());
schAbsences.DataSource = list;
}