This is a migrated thread and some comments may be shown as answers.

weird behaviour on drag and drop

3 Answers 53 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Emrah
Top achievements
Rank 1
Emrah asked on 09 Aug 2013, 12:03 PM
Greetings,
I am trying to implement a work schedule using rad scheduler tool.
Everything went good so far until I tried to implement drag and drop on engineer schedule.
I use onAppointmentDataBound to color daily shifts, nothing else.
and to get the information of "start and end times" as well as task id..etc, I am using onAppointmentUpdate at code behind, however I am experiencing a problem such as change in the text of appointment and change the time and color of existing tasks and tooltips of the engineer.
Notice in the screenshots, i am trying to move a task to 17:00 for the same engineer, but scheduler places the task into 15:30 while changing the daily shift (blue task) to something else
In the demos, I couldn't find any examples to specifically handle the drag and drop to avoid such problems.
Any help would be appreciated
Kind regards
Emrah

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 13 Aug 2013, 10:53 AM
Hi Emrah,

 
Basically Drag and drop of the appointments is inbuilt functionality and you do no have to implement any other code since you have implemented properly the DataBinding of RadScheduler. Here is a sample demo where is illustrated how it can be working properly in TimelineView.

If you are still having difficulties in implementing it please share the exact mark up and code behind connected to RadScheduler that you are using so we could inspect it and be more helpful.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Emrah
Top achievements
Rank 1
answered on 13 Aug 2013, 12:15 PM
Dear Plamen,
Thank you for your reply.
I have already checked most of the demos and related forum topics on the issue but couldn't come across a solution so far.
While trying for different scenarios, I noticed that I encounter with the problem when there's multiple tickets assigned to an engineer (when there are multiple appointments in one row).
In your examples, the query is written on the client side, right under radscheduler definition but I have to work on server side and am dealing with stored procedures.  Here's my definition on the client side and the related code on the server side

<telerik:RadScheduler runat="server" ID="radZeitPlan" Width="100%" Height="60%" AllowInsert="false"
                    SelectedView="TimelineView" DataSubjectField="task" ReadOnly="false" DayStartTime="08:00:00"
                    DayEndTime="23:00:00" DataKeyField="UserID" DataEndField="endDate" DataStartField="startDate"
                    OverflowBehavior="Auto" EnableDatePicker="true" Skin="Sunset"
                    OnAppointmentContextMenuItemClicked="radZeitPlan_AppointmentContextMenuItemClicked"
                    OnClientAppointmentInserting="onAppointmentInserting" OnTimeSlotContextMenuItemClicked="radZeitPlan_TimeSlotContextMenuItemClicked"
                     OnAppointmentDataBound="radZeitPlan_AppointmentDataBound"
                    OnAppointmentUpdate="radZeitPlan_AppointmentUpdate">
                    <AdvancedForm Modal="true" />
                    <TimelineView GroupingDirection="Vertical" ColumnHeaderDateFormat="HH:mm" SlotDuration="00:30"
                        NumberOfSlots="35" StartTime="07:00:00" HeaderDateFormat="d/M/yyyy" />
                    <WeekView GroupingDirection="Vertical" ColumnHeaderDateFormat="HH:mm" />
                    <DayView GroupingDirection="Vertical" ShowHoursColumn="true" />
                    <ResourceTypes>
                        <telerik:ResourceType ForeignKeyField="UserID" KeyField="UserID" TextField="fullname"
                            Name="myResource" AllowMultipleValues="true" />
                    </ResourceTypes>
                    <TimeSlotContextMenuSettings EnableDefault="true"></TimeSlotContextMenuSettings>
                    <AppointmentContextMenuSettings EnableDefault="true"></AppointmentContextMenuSettings>
                    <TimeSlotContextMenus>
                        <telerik:RadSchedulerContextMenu runat="server" ID="radTimeSlotMenu">
                            <Items>
                                <telerik:RadMenuItem Text="View Tickets by This FE">
                                </telerik:RadMenuItem>
                            </Items>
                        </telerik:RadSchedulerContextMenu>
                    </TimeSlotContextMenus>
                    <AppointmentContextMenus>
                        <telerik:RadSchedulerContextMenu runat="server" ID="radAppointmentMenu">
                            <Items>
                                <telerik:RadMenuItem Text="View On Map" Value="ticket">
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem Text="View Tickets by This FE" Value="byFE">
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem Text="View Tickets by This Site" Value="bySite">
                                </telerik:RadMenuItem>
                            </Items>
                        </telerik:RadSchedulerContextMenu>
                    </AppointmentContextMenus>
                </telerik:RadScheduler>





public void BindSchedule()
        {
            DataSet ds2 = myObj.GetScheduleData(ddlGroup.SelectedValue); //get daily shifts to be shown in blue
 
            DataSet ds1 = myObj.EngineerDailyAssignmentGet(ddlGroup.SelectedValue); //get engineer tasks
 
            ResourceType t = radZeitPlan.ResourceTypes.FindByName("myResource") as ResourceType;
            t.DataSource = ds2; //bind engineer shifts to resource for grouping
            radZeitPlan.GroupBy = "myResource";//enable grouping
 
            ds2.Merge(ds1); //merge datasets to be added to resource
            radZeitPlan.DataSource = ds2; //bind merged dataset to scheduler
            radZeitPlan.DataBind();
 
           
        }
also AppointmentDataBound, I'm using the following to select color for appointments (the text area for the tickets start with the string "SV", that's how I distinguish them)

protected void radZeitPlan_AppointmentDataBound(object sender, SchedulerEventArgs e)
        {
            if (e.Appointment.Resources.GetResourceByType("myResource") != null)
            {
                if (e.Appointment.ToolTip.ToString().Substring(0, 2) != "SV")
                {
 
                    e.Appointment.BackColor = Color.LightBlue;
                    e.Appointment.AllowEdit = false;
                    e.Appointment.AllowDelete = false;
                }
                else
                {  
                    e.Appointment.AllowDelete = false;
                }
            }
        }

I actually tried to assign the tickets to another resource but then they did not show up in the scheduler, I ended up getting a scheduler with only the engineers listed on the left but no data inside. It would be really kind of you if you could also help me finding a way to display appointments on the scheduler without binding the entire data using radScheduler.DataSource. and as I said the demos didn't work for me since I am working on the server-side.

0
Plamen
Telerik team
answered on 15 Aug 2013, 05:13 AM
Hello,

 
In this scenario we strongly recommend following the structure that we use in this on-line demo and that is explained in this help topic when you use DataSource property of RadScheduler. Please don't forget to implement the insert, update and delete methods of RadScheduler because otherwise the drag and drop may not work properly.

Hope this will be helpful.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Scheduler
Asked by
Emrah
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Emrah
Top achievements
Rank 1
Share this question
or