Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag And Drop outside the calendar [SOLVED] #318

Closed
martinnov92 opened this issue Mar 14, 2017 · 13 comments
Closed

Drag And Drop outside the calendar [SOLVED] #318

martinnov92 opened this issue Mar 14, 2017 · 13 comments

Comments

@martinnov92
Copy link
Contributor

martinnov92 commented Mar 14, 2017

Hello,

is it possible to drag and drop something to calendar from the outside (let say that I create a draggable div and want that div to be able to DnD to calendar)? Or is it only working inside the calendar?

Thank you very much.

Update: solved

@brik-dm
Copy link

brik-dm commented Mar 17, 2017

How did you solve this?

@martinnov92
Copy link
Contributor Author

martinnov92 commented Mar 17, 2017

Hello @spacedust,

I created a drop target component, where I am passing a function (where I strip the date off the event and in the drop zone component I filter the events without dates) as a prop and call it on a React DND drop() method. Hope it makes sense, here is an example:

drop(props, monitor) {
    // call the function from parent element and pass there 'event' from the React Big Calendar
    return props.onDropTarget(monitor.getItem());
 },

It is working for me, but I am not so sure if calling a function from drop() is the proper way how to do it.

@martinnov92 martinnov92 changed the title Drag And Drop outside the calendar Drag And Drop outside the calendar [SOLVED] Mar 17, 2017
@jupiterkenji
Copy link

jupiterkenji commented Sep 1, 2017

@martinnov92 how do you pass the location of the event to the droppable? could you elaborate on "where I strip the date off the event and in the drop zone component I filter the events without dates". Do you wrap the whole BigCalendar inside connectDropTarget?
Thank you

@martinnov92
Copy link
Contributor Author

Hello, I can't remember now, might have a look on it on Monday. By strip the date off I mean that I removed date from event to not to display it in the calendar. And no, the big calendar is already drop target I think. If I don't forget I will add example on Monday.

@martinnov92
Copy link
Contributor Author

Oh and you have to set the correct name for drop target (the name you set when you are adding connectDropTarget(name,...)). I think the name should be "Event"...

@jupiterkenji
Copy link

Thank you @martinnov92 I'll check it out =)

@SagiSan
Copy link

SagiSan commented Mar 17, 2018

Can anyone post a working example of outside drag n drop to calendar please?

@Tim1023
Copy link

Tim1023 commented Apr 4, 2018

@SagiSan Here is an example on my repo https://github.com/Tim1023/react-scheduler-firebase. Hope it can help you

@Abenezer
Copy link

@SagiSan nice! it used to work for big-calendar 19 but new updates (https://github.com/intljusticemission/react-big-calendar/tree/master/src/addons/dragAndDrop) cause the drop is always diabled. may be the item type changed? or they used another plugin (because if you look the file EventWrapper ) there is no dropTarget.
for now i am falling back to v 19.0 can you make it work for 20 an up

@MinhNguyen41092
Copy link

@Abenezer have you found any way to make it work? Also you @ the wrong person.

@mikailbayram
Copy link

mikailbayram commented Jan 20, 2019

@Abenezer have you found a way to make it work on v 20. and up?

@milkysingh
Copy link

@Abenezer Is there any way I can make it work with v20 and up? It will be a great help.

@tommyspot
Copy link

@Tim1023 Do you have any update example with v20. The above example doesn't work with v20 and up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants