Lighthouse Developer
Top achievements
Rank 1
Lighthouse Developer
asked on 15 May 2010, 10:14 PM
Hi,
I drag and drop items from a radlistbox into a resource grouped scheduler with Timeline as active viewtype.
How I can get the resource id and the date from the cell where an item was dropped?
I drag and drop items from a radlistbox into a resource grouped scheduler with Timeline as active viewtype.
How I can get the resource id and the date from the cell where an item was dropped?
7 Answers, 1 is accepted
0
Hi Lighthouse Developer,
Thank you for contacting us.
Please, review the following example (installed with RadControls for WinForms) on how to take the cell where the item is being dropped: Demos -> Scheduler ->D rag&Drop example. From the example, take the cell's View.GetResources()[0]. When you are in grouping mode this collection contains only one item for each group:
I hope that this will help you. If you have other question do not hesitate to contact us.
Best wishes,
Dobry Zranchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thank you for contacting us.
Please, review the following example (installed with RadControls for WinForms) on how to take the cell where the item is being dropped: Demos -> Scheduler ->D rag&Drop example. From the example, take the cell's View.GetResources()[0]. When you are in grouping mode this collection contains only one item for each group:
private
void
radScheduler1_DragDrop(
object
sender, DragEventArgs e)
{
Point point =
this
.radScheduler1.PointToClient(
new
Point(e.X, e.Y));
DayViewAppointmentsTable table = (
this
.radScheduler1.SchedulerElement.ViewElement
as
SchedulerDayViewElement).DataAreaElement.Table;
SchedulerCellElement schedulerCell = SchedulerUIHelper.GetCellAtPoint(point, table.Children);
DragObject dragObject = e.Data.GetData(
typeof
(DragObject))
as
DragObject;
if
(dragObject !=
null
)
{
this
.radScheduler1.Appointments.BeginUpdate();
Appointment appointment = CreateAppointment(schedulerCell.Date, dragObject);
appointment.ResourceId = schedulerCell.View.GetResources()[0].Id;
this
.radScheduler1.Appointments.Add(appointment);
this
.radScheduler1.Appointments.EndUpdate();
}
}
I hope that this will help you. If you have other question do not hesitate to contact us.
Best wishes,
Dobry Zranchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Lighthouse Developer
Top achievements
Rank 1
answered on 20 May 2010, 02:46 PM
Hi Dobry
and thank you very much for your help.
I cant get drag and drop to work in Timeline view.
In scheduler's DragDrop function this statement:
doesn't seem to be right.If I executed it in visual studio's immediate window I get this:
"this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement' is null"
I have created a sample project.If the active view is Day view,drag n drop works as expected. In Timeline view it doesn't work. Can we use something else than SchedulerDayViewElement? I saw that when the scheduler is in Timeline View the radScheduler1.SchedulerElement.ViewElement is of type SchedulerTimelineViewElement.
and thank you very much for your help.
I cant get drag and drop to work in Timeline view.
In scheduler's DragDrop function this statement:
DayViewAppointmentsTable table = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement).DataAreaElement.Table; |
doesn't seem to be right.If I executed it in visual studio's immediate window I get this:
"this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement' is null"
I have created a sample project.If the active view is Day view,drag n drop works as expected. In Timeline view it doesn't work. Can we use something else than SchedulerDayViewElement? I saw that when the scheduler is in Timeline View the radScheduler1.SchedulerElement.ViewElement is of type SchedulerTimelineViewElement.
0
Hi Lighthouse Developer,
Before getting to your question, we would like to request to please update your account with your name, surname and nick name. This will allow us to work with you better. Thank you for your understanding.
Depending on the ActiveView, RadScheduler creates a different element which could be SchedulerDayViewElement, SchedulerMonthViewElement, SchedulerTimelineViewElement, or SchedulerMultiDayViewElement. When you have enabled the grouping mode, RadScheduler can create a SchedulerDayViewGroupedByResourceElement, SchedulerMonthViewGroupedByResourceElement or SchedulerTimelineViewGroupingByResourcesElement. When you implement a custom drag and drop functionality, you need to get the instance of the ViewElement and cast it to the proper element.
In your scenario, if you implement a drag and drop and your ActiveView is Timline, you need to use the SchedulerTimelineViewElement. If you have resources and your ActiveView is Timeline, you need to use the SchedulerTimelineViewGroupingByResourcesElement. The last has a method called GetTimelineElements which will give you the collection of the TimelineViewElements which are part of the SchedulerTimelineViewGroupingByResourcesElement.
If you have additional questions, we will be happy to help you.
Best wishes,
Boyko Markov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Before getting to your question, we would like to request to please update your account with your name, surname and nick name. This will allow us to work with you better. Thank you for your understanding.
Depending on the ActiveView, RadScheduler creates a different element which could be SchedulerDayViewElement, SchedulerMonthViewElement, SchedulerTimelineViewElement, or SchedulerMultiDayViewElement. When you have enabled the grouping mode, RadScheduler can create a SchedulerDayViewGroupedByResourceElement, SchedulerMonthViewGroupedByResourceElement or SchedulerTimelineViewGroupingByResourcesElement. When you implement a custom drag and drop functionality, you need to get the instance of the ViewElement and cast it to the proper element.
In your scenario, if you implement a drag and drop and your ActiveView is Timline, you need to use the SchedulerTimelineViewElement. If you have resources and your ActiveView is Timeline, you need to use the SchedulerTimelineViewGroupingByResourcesElement. The last has a method called GetTimelineElements which will give you the collection of the TimelineViewElements which are part of the SchedulerTimelineViewGroupingByResourcesElement.
If you have additional questions, we will be happy to help you.
Best wishes,
Boyko Markov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Lighthouse Developer
Top achievements
Rank 1
answered on 21 May 2010, 04:28 PM
Thank you very much Boyko.
Unfortunately I cant find the class SchedulerTimelineViewGroupingByResourcesElement. Is there a specific reference that I need to include?
Thank you again
Unfortunately I cant find the class SchedulerTimelineViewGroupingByResourcesElement. Is there a specific reference that I need to include?
Thank you again
0
Hello Lighthouse Developer,
Thank you for writing back.
Please excuse us for inconvenience - the type of the element is TimelineGroupingByResourcesElement rather than SchedulerTimelineViewGroupingByResourcesElement.
If you have other questions feel free to contact us.
Regards,
Dobry Zranchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thank you for writing back.
Please excuse us for inconvenience - the type of the element is TimelineGroupingByResourcesElement rather than SchedulerTimelineViewGroupingByResourcesElement.
If you have other questions feel free to contact us.
Regards,
Dobry Zranchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Aaron
Top achievements
Rank 1
answered on 26 Feb 2013, 10:11 PM
I have a similar issue. I am in grouped day view and on this line I am getting an error
I see that what I need to cast the ViewElement as in this case is a SchedulerDayViewGroupedByResourceElement. The problem is that the SchedulerDayViewGroupedByResourceElement has no DataAreaElement.Table to pull out.
Where can I find the DayViewAppointmentsTable in the SchedulerDayViewGroupedByResourceElement?
DayViewAppointmentsTable table = (
this
.radScheduler1.SchedulerElement.ViewElement
as
SchedulerDayViewElement).DataAreaElement.Table;
I see that what I need to cast the ViewElement as in this case is a SchedulerDayViewGroupedByResourceElement. The problem is that the SchedulerDayViewGroupedByResourceElement has no DataAreaElement.Table to pull out.
Where can I find the DayViewAppointmentsTable in the SchedulerDayViewGroupedByResourceElement?
0
Hello Aaron,
In this view SchedulerDayViewGroupedByResourceElement contains several SchedulerDayViewElement objects, each one specific for a different resource. You can get these elements by using the GetDayViewElements method. Consider the sample below:
I hope it helps.
Regards,
Jack
the Telerik team
In this view SchedulerDayViewGroupedByResourceElement contains several SchedulerDayViewElement objects, each one specific for a different resource. You can get these elements by using the GetDayViewElements method. Consider the sample below:
SchedulerDayViewGroupedByResourceElement viewElement = radScheduler1.SchedulerElement.ViewElement
as
SchedulerDayViewGroupedByResourceElement;
foreach
(SchedulerDayViewElement dayViewElement
in
viewElement.GetDayViewElements())
{
DayViewAppointmentsTable table = dayViewElement.DataAreaElement.Table;
//...
}
I hope it helps.
Regards,
Jack
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more.
Join us for a FREE webinar to see all the new stuff in action.
Interested, but can’t attend? Register anyway and we’ll send you the recording.
Interested, but can’t attend? Register anyway and we’ll send you the recording.