Ticket Q524459
Visible to All Users

Implement Drag drop between 2 scheduler controls

created 11 years ago

Hi, an am having difficulty getting a desired behavior when implementing drag and drop for appointments.
Form1
has
a) Scheduler1 (Storage1) - in Gantt view, resources are people/users
b) Grid1 - list of un-allocated tasks
c) custom control with Scheduler2 (storage2) - in day view, used for recording time against a "work log" item.
I'm part way there.
The user can drag a row from the gird onto either scheduler to create a new appointment (that works fine).
If the user drags an appointment from Scheduler1 to Scheduler2 (or vice versa) the appointment is created with missing "custom field" mappings, and it tries to delete the appointment from the source scheduler.
How can I implement a drag drop between 2 schedules and implement custom appointment creation as you do with the grid and not have it trigger that code when you are just moving the appointment around on its own scheduler (as the drag drop event fires for its own appointments as well as external drops coming in).
Any suggestions would be much appreciated.
Regards,
Joel

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hi,
I'm afraid the SchedulerControl always removes appointments after moving them into another SchedulerControl. However, it is possible to implement this behavior manually via handling the AppointmentDrag, AppointmentsChanged and AppointmentDeleting events and preventing deleting of appointments in the AppointmentDeleting event handler. I've attached a sample project that illustrates this approach. Please review it.
As for custom field mappings, both your SchedulerControls should have the same mappings for custom fields and you need to set them manually. In this case you will be able to get a custom field in the second SchedulerControl. I've implemented this in my sample, too. You can set a breakpoint in the schedulerControl2_SelectionChanged method and see that appointments form the second ScedulerControl have a value in the CustomFields["Test"] property as their original appointments from the first ShcedulerControl.
Feel free to contact us if you need additional information.
Thanks

    Show previous comments (1)
    DevExpress Support Team 11 years ago

      Hi,
      CustomFields are copied with appointments. A sample from my answer shows this. I've also attached a video. Would you please provide me with a sample showing that CustomFields are not copied? It will help me find the cause of this issue. I am looking forward to your response.

      JM JM
      joel meikle (Radfords) 11 years ago

        Hi Alex, I can see in your project that the "test text" was indeed copied across.
        It was when or the event I was checking for them, the Scheduler_AppointmentDrop event has the correct details but I needed to do some custom work on the Insert to fill out some other properties and the appointment passed into there was a new appointment without the values copied across yet.
        I solved this by caching the Scheduler_AppointmentDrop(ed) object and used that on the insert event, works great.
        Thanks for your reply

        DevExpress Support Team 11 years ago

          Hi,
          Thank you for informing us that you have found a way to resolve the issue you mentioned.
          Should you have any questions regarding our products or need our further assistance, do not hesitate to contact us.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.