Drag and drop only in one direction

7 posts, 0 answers
  1. Lasse
    Lasse avatar
    2 posts
    Member since:
    Oct 2010

    Posted 25 Oct 2010 Link to this post

    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
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 27 Oct 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hristiyan
    Hristiyan avatar
    4 posts
    Member since:
    Apr 2008

    Posted 28 Oct 2010 Link to this post

    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?
  5. DoomerDGR8
    DoomerDGR8 avatar
    133 posts
    Member since:
    Aug 2010

    Posted 28 Oct 2010 Link to this post

    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.
  6. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 02 Nov 2010 Link to this post


    @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
  7. Hristiyan
    Hristiyan avatar
    4 posts
    Member since:
    Apr 2008

    Posted 03 Nov 2010 Link to this post

    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?
  8. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 05 Nov 2010 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017