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

Moving appointments using client-side script

2 Answers 58 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 22 Nov 2010, 08:33 PM
Hi there,

I am trying to do something with the scheduler that I'm not sure is possible.  Essentially, I want to allow users to "swap" two items - so if they drag an appointment over another appointment which is exactly the same duration, I would like the two appointments to swap positions.  

I have got the javascript going well enough to capture the onAppointmentMoving event to test to see if the appointment is being dragged onto another appointment, and have got logic to determine if the underlying appointment is of the same duration.  However, it's the last step that is causing me problems.

Once the user has held the moving appointment over an appointment of the same size for 2 seconds, I would like the underlying appointment to take up the position previously held by the other appointment.  Again, I've got the timeout bit working, but I don't want to post back to the server yet, I just want to the appointment to "tentatively" move - if the user were to press escape, or to move the moving appointment over another appointment, the previous one should revert to where it was, and the OTHER appointment be the one that was swapped.  Only when the user releases the mouse button do I want a postback to occur.

I have fiddled around in the client-side api for a bit and found a couple of promising functions: repaint and updateAppointment.  However, repaint doesn't seem to actually repaint, and updateAppointment causes a postback.  

Is there a way to do what I am after?  If not via natively implemented functions on the scheduler, could you point me in the right direction for actually manipulating the underlying HTML to do what I'm after?  I guess the appointments render as divs, so I figure I could probably get the left and top positions of those items, and reset them accordingly?  Can you point me in the right direction regarding which Ids I would need to grab hold of or how to get a reference to the containing divs?

Thanks very much for your help.

Matthew

2 Answers, 1 is accepted

Sort by
0
Kamen Bundev
Telerik team
answered on 25 Nov 2010, 06:05 PM
Hello Matthew,

You can try moving the HTML elements which form the appointment and then return them back - as long as they stay within the table, they will look like an appointment. Select the div.rsWrap element under your moving appointment and move it to the drag appointment original position, on cancel - return it back. This will act only as cue as the actual appointment is not moved. I hope this helps.

Regards,
Kamen Bundev
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Matthew
Top achievements
Rank 1
answered on 25 Nov 2010, 08:13 PM
Thanks Kamen, I'll give that a go.
Tags
Scheduler
Asked by
Matthew
Top achievements
Rank 1
Answers by
Kamen Bundev
Telerik team
Matthew
Top achievements
Rank 1
Share this question
or