search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Keep drag and drop preview through rerenders

Asked by Anonymous
8 months ago.

We are developers of RTM.

When a entry in the DayPilot.Scheduler is being dragged, a gray box is shown in the cell where the item would be moved to. If in the meanwhile the input data changes that box disappears. (It will eventually reappear when I leave and enter the component while still dragging the item.)
An example for that would be if data is being partially loaded to cover the visible area and by dragging an item to the edge more data comes into view, triggering a reload.

Answer posted by Dan Letecky [DayPilot]
7 months ago.

Sorry for the delay!

I assume that you are using dynamic event loading to load additional data during scrolling (onScroll event).

In the event handler, you should only update the Scheduler by calling args.loaded(). That works fine when dragging is in progress in my tests. If you use the full update, it may disrupt the current state.

Please let me know if it doesn’t help.

Comment posted by Anonymous
7 months ago.

Thank you for the Information.

The mentioned function works for a part of the issue so thank you for that.
While scrolling we set the new events using the args.loaded().

Now there are other reasons why event data changes. So is there a way for you to cache the drag state, so it survives re renders in React?

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.