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
Select and move/edit multiple events #2253
Comments
Reported by
|
Reported by |
Reported by |
Reported by |
Reported by |
Reported by |
Reported by |
Reported by |
Reported by |
Reported by |
Is this feature still being worked on? I am planning to implement the scheduler version of fullcalendar and one of my requirements is moving and re-sizing multiple events simultaneously. I am trying to decide if I should come up with a specific solution to my problem or if this will be part of the base tool at some point. Thanks for any insight you can provide. Great tool by the way, it's been very simple to implement but provides outstanding hooks to the various events to implement custom functionality easily. |
I really need this multi-select feature. I need to be able to select multiple calendar events and drag all of the selected calendar events at the same time. |
Any progress? I really need this multi-select feature. |
FullCalendar is an open source project. Feel free to make a pull request. See http://fullcalendar.io/wiki/Contributing/ |
Here's how I ended up doing the multi-select; I added checkboxes to each calendar item. This is a working multi-select feature. I'm using it in a production website. FYI - This does not do any lassoing. Again, it relies on checkboxes. Also, this moves the items on the calendar and sends the update to the server without doing a page refresh. @TomLynchTM @glagola With this method (below), the user must check the box on each calendar item and then move one of the calendar items to the desired date. After moving one item, all the other checked calendar items will be moved to the new date as well.
|
I was able to implement my own version of this for a client. I accomplished it basically by assigning a highlighted class to events on click, and modifying the behavior if the user holds down shift. Dragging and dropping multiple events was challenging. I essentially made a container and cloned the selected events and placed them inside and dragged that - then wrote methods in the drop callback to loop through selected events to add or update calendar event data. The positioning of events in the cloned container when dragging was fairly challenging too, along with calculating positioning when dropping multiple or updating multiple event time offsets when dragging multiple. This is, however, all possible though. Personally I didn't have to go as far or as complicated as the fork that was posted above. |
+1 for this feature |
+1 for this feature |
I wish I had time to contribute and add what I did but it was really involved and unfortunately sallie mae owns my soul. Maybe one day I'll try to make a gist. |
@arshaw I recently had a brainstorming session with a client. He wanted to have a button that would "flag" multiselect mode. When in multiselect mode, any click on any event would highlight/select the event. The user would be able to keep selecting events until he moved one of the events to a new day on the calendar. When one of the selected events was moved to a new day, all of the selected events would move to that same day. At this point, the multiselect flag would be cleared. Just an idea you may be interested in implementing in fullCalendar. P.S. Not sure how this would work on Day view. |
@alex-barberi The way I did it was to hold down shift or control. |
@gregblass Definitely a good option. However, we found it annoying to hold down CTRL... Then accidentally let go of CTRL and click something, only to lose all your selections. However, holding down shift or ctrl is still a viable option. From a User Experience perspective, I think there are better options, but holding down Ctrl or Shift was the first thing we thought of doing. And Ctrl or Shift could be good because it is what people are used to doing. From a developer perspective, I'm not sure about how good of an idea it is to bind to key events in the browser and rely on those events with the calendar, but maybe there is a safe way to do this. Definitely some unknowns & "scary things" for me here, but it sounds like Ctrl or Shift could still be a good option. |
Has many options for doing the multiple selection. Would be nice if we could choose the better way to do that. Just something like: {
multiple_selection: true
} Then, marking the event with something (a css class?) and, in dragging, the fullcalendar does the magic with the marked ones. Full Calendar just should give us a way/function/option to mark some event, and unselect too. But who marks the events (using the fullcalendar api) is the developer in the way that he thinks best |
+1 for this feature |
+1. Hope to see this in a future version of fullcalendar |
+1 :) |
+1 |
I know this is old but I ran into this issue just now. I tried your approach but after adding a class to an event and calling .fullCalendar('update') on it the event cannot be dragged (it dissapears when start dragging). Do you know this issue? |
If anyone runs into this: it was because I was actually using the Ctrl key for selecting. Using shift doesn't cause this bug. |
I'm thinking about a quite simple workaround for my most common use case.
|
Here is what I'm doing to move the following events if needed: function sameDay(d1, d2) {
return d1.getFullYear() === d2.getFullYear() &&
d1.getMonth() === d2.getMonth() &&
d1.getDate() === d2.getDate();
}
function moveableNextEvents(currentEvent, events) {
// Checking if there is an event right after the current one
if (!events.find(event => event.start.getTime() === currentEvent.end.getTime())) return;
// Getting the events after the current one in the same day
const nexts = events.filter(event => {
return sameDay(event.start, currentEvent.start)
&& event.start.getTime() > currentEvent.start.getTime()
&& event.id !== currentEvent.id
;
});
if (!nexts.length) return;
// Asking the user a confirmation if any concerned events have been found
if (!confirm('Do you want to move the following ' + nexts.length + ' event(s) alongside ?')) return;
return nexts;
}
function getEventsWithDelta(events, newEvent, oldEvent) {
const moveableEvents = moveableNextEvents(oldEvent, events, skipConfirm);
if (!moveableEvents || !moveableEvents.length) return [];
// Getting the delta from a modified start (move) or end (resize)
const millisecondsDelta = (newEvent.start.getTime() - oldEvent.start.getTime())
|| (newEvent.end.getTime() - oldEvent.end.getTime())
moveableEvents.forEach(event => {
// Using dayjs here to apply the delta but any other can do
event.start = dayjs(event.start).add(millisecondsDelta, 'ms');
event.end = dayjs(event.end).add(millisecondsDelta, 'ms');
});
return moveableEvents;
}
// I'm updating the events directly here but we might better create new ones Here how it can be used from // fcApi contains the fullCalendar instance
eventDropOrResize({ event, oldEvent }) {
// Updating the original event
update(event);
// Moving all next events if needed
getEventsWithDelta(fcApi.getEvents(), event, oldEvent).forEach(nextEvent => {
update(nextEvent);
});
} This alternative is fine for my use case, I don't need a more elaborate multiple selection. |
Originally reported on Google Code with ID 1988
Reported by
doug@onvelocity.com
on 2013-09-04 13:29:08Imported with 13 stars
The text was updated successfully, but these errors were encountered: