Moving appointments using client-side script

3 posts, 0 answers
  1. Matthew
    Matthew avatar
    26 posts
    Member since:
    Dec 2007

    Posted 22 Nov 2010 Link to this post

    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.


  2. Kamen Bundev
    Kamen Bundev avatar
    1532 posts

    Posted 25 Nov 2010 Link to this post

    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.

    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.
  3. DevCraft R3 2016 release webinar banner
  4. Matthew
    Matthew avatar
    26 posts
    Member since:
    Dec 2007

    Posted 25 Nov 2010 Link to this post

    Thanks Kamen, I'll give that a go.
Back to Top