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

Drag and drop only in one direction

6 Answers 111 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Lasse
Top achievements
Rank 1
Lasse asked on 25 Oct 2010, 10:52 AM
Hi,

Is it possible to restrict dragging and dropping of appointments to only one direction? For example in the timeline view only allow moving of appointments from one resource to another (vertically) and not allow the changing of the time of the appointment (horizontally)? Would it be possible to restrict dragging and dropping so that movement would be possible only in one direction at a time?


--
Lasse

6 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 27 Oct 2010, 02:55 PM
Hello Lasse,

Yes, you can cancel OnClientAppointmentMoveEnd conditionally like this:

<script type="text/javascript">
   function OnClientAppointmentMoveEnd(sender, eventArgs) {
       if (eventArgs.get_appointment().get_start().format('yyyy/MM/dd HH:mm') != eventArgs.get_newStartTime().format('yyyy/MM/dd HH:mm')) {
          eventArgs.set_cancel(true);
       }
   }    
   </script>
   <telerik:RadScheduler ID="RadScheduler1" runat="server" Skin="Windows7" SelectedView="TimelineView"
       GroupingDirection="Vertical" GroupBy="User" OnClientAppointmentMoveEnd="OnClientAppointmentMoveEnd">
       <AdvancedForm Modal="true" />
   </telerik:RadScheduler>


Greetings,
Peter
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
Hristiyan
Top achievements
Rank 1
answered on 28 Oct 2010, 09:20 AM
Hi Peter,

That would only cancel the "drop" of the appointment but won't restrict the "drag" movement to be happening in only one direction, horizontally, which was what Lasse asked for.

Do you think such restriction of the drag movement is possible with your control?
0
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
answered on 28 Oct 2010, 11:21 AM
I'm currently working with the Scheduler myself and will soon require this functionality. Instead of Appointments, I deal with Jobs. A job has a fixed date when it is created. I'm currently trying to implement on the Client-Side, the functions to automatically set the SelectedDate of the scheduler to the JobDate value of the column from the Grid's row dropped on the scheduler. This way, the user will probably face a lot of AJAX loading as the Scheduler is heavily populated. But I'm to work in Timeline view only and the remaining views show a long range time slot. My restriction is that there can be only two jobs in a day against a resource. And the jobs cannot span across to next dates as well. I'll be asking a lot of questions soon.
0
Peter
Telerik team
answered on 02 Nov 2010, 02:42 PM

@Hristiyan
If the drag itself was canceled then RadScheduler will not know where you intended to drop the appointment. Please, let me know if I have misunderstood somehow your question.

@Hassan
I suggest you review the Resource Availability demo and use it as a starting point for your case.


Greetings,
Peter
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
Hristiyan
Top achievements
Rank 1
answered on 03 Nov 2010, 09:24 AM
Hi Peter,

Thanks for your reply.

Perhaps I wasn't clear enough. By restricting the drag movement, I didn't mean canceling the drag but only allow it in one direction - by this I mean setting constrains of the dragging to either the horizontal(x) or vertical(y) axis.

In other words, functionality such as this one: http://jqueryui.com/demos/draggable/#constrain-movement ; would it be possible to implement with the current version of the control?
0
Peter
Telerik team
answered on 05 Nov 2010, 05:10 PM
Hi Hristiyan,

It should be possible using the jQuery plugin you suggested. You can access the appointment's outer div using the rsWrap class.


Greetings,
Peter
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
Tags
Scheduler
Asked by
Lasse
Top achievements
Rank 1
Answers by
Peter
Telerik team
Hristiyan
Top achievements
Rank 1
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or