Issue 364: Customising vertical ordering of events (month, basicWeek, basicDay)
Status:  Released
Owner: ----
Closed:  Aug 2015
Reported by stu...@paulshand.com, Feb 24, 2010
The events I've setup are all 'all day' events (I'm using Google Calendar). Is there any way to 
order the events that display in the calendar (front-end) by Event Title, rather than Event 
Modification Date which it defaults to? At the moment, any time I modify an event description 
that event is put to the top of the FullCalendar display whereas I'd like them always to 
display ordered by title.

Feb 26, 2010
Project Member #1 adamrs...@gmail.com
this could be a useful feature. i will hold off on accepting it until i hear more
people that need it. thanks
Labels: -Type-Defect Type-Enhancement
Jul 12, 2010
#2 ales.fu...@gmail.com
the ordering of allDay events would be really usefull for me. The best way would be throught some parameter, but title ordering would be ok too.
Aug 25, 2010
Project Member #3 adamrs...@gmail.com
 Issue 563  has been merged into this issue.
Aug 26, 2010
Project Member #4 adamrs...@gmail.com
right now it sorts by duration, then start time. should be able to customize this. accepting.
Summary: Customising vertical ordering of events (month, basicWeek, basicDay)
Status: Accepted
Oct 21, 2010
#5 nicholas...@gmail.com
What is the status of this ticket?  I agree this would be a great feature, to be able to sort how the events are stack in the allDay section.
Mar 21, 2011
#6 bhen...@gmail.com
I'd like this as well.  In my app I have a reason to delete an event, and then add it back again (stick=true) which puts it at the bottom of my month view of all-day events. I'd love to be able to be either to either:

1. Find out what order it was, and then put it back to that order after I remove/add.
or
2. Set FC to auto-order by title, and have it automatically plop back into place.

-Brian
May 12, 2011
#7 ajdanie...@gmail.com
I would really appreciate this feature!
May 16, 2011
#8 gmsai...@gmail.com
any date when we can have this feature?
http://goo.gl/TUnyt
Jun 26, 2011
#9 chris.po...@gmail.com
'+1' for that feature :)
Jul 12, 2011
#10 Maantju...@gmail.com
+1 for me too.

In my example:

I have multiple events, signed to users. Now ideally I would like to sort the events in the order, that the events to a specific user are below each other, instead of ordering on time length. 
Aug 12, 2012
#12 stephen...@gmail.com
It would also be nice if you could specify certain events list at the bottom of the day for the month view, i.e. if you have a schedule for activities, and you want to note individuals unavailability at the bottom of the day (not the bottom of the list, but at the bottom of the day) or you want to indicate national or individual holidays or other times when you are unavailable, or some other admin information for a specific day/days, but not as a scheduled task, just information.
Aug 14, 2012
#13 turbo2...@gmail.com
It would be nice if all-day events would be listed in the same order they are in the JSON string.  Right now I have multi- all-day events at different venues and they don't show up in a row for the week despite the JSON string being ordered by date, start time and venue.  They seem to be put in the calendar at random.
Aug 29, 2012
#14 gaikwad...@gmail.com
+1 for this feature. Ordering by custom event parameter would be great. :)
Sep 10, 2012
#15 ma.are....@gmail.com
+1 this would really help polishing the functionality
Apr 3, 2013
#16 tangle5...@gmail.com
Pls accept and work on this now.  Would be helpful.
Apr 8, 2013
#17 nickferg...@gmail.com
I have to subscribe to some calendars for non-profits I help out, but it'd be nice to set them to a lower priority so my appointments don't get buried in a +2 or whatever every time there's a day with multiple events.  If I could control the order on month view that'd really help.  So I suggest the ability to drag other calendar entries to a lower priority on the side list, or at least on a given day be able to drag something around.
May 31, 2013
#18 matous.k...@gmail.com
it would be nice in month view
May 31, 2013
#19 stephen...@gmail.com
Maybe we can do some kind of x and y axis order/index (even a z index as well) for all 3 calendar views.
Jun 2, 2013
#20 merced...@yahoo.com
Alphabetization of All Day Events would be great!
Please consider.
Jun 6, 2013
#21 leah.cha...@gmail.com
I could really use this too.  I need the events to stay in a particular order so that I can show a sort of "header" event that spans across the week, and then have other day-level events under it.  The problem I have is that I need to have multiple of these "header" events with their respective day events under them, but all the week-long events will float to the top with the given implementation.  Many thanks for any assistance you can provide!
Jul 31, 2013
#22 kevinhil...@gmail.com
+1 for this feature. All my events for a particular calendar are "all day" events and I would like to be able to control the order, either by specifying an additional param in the JSON feed or enabling an option to output the items in the order they appear in the JSON feed's events array.
Aug 2, 2013
#23 tenderto...@gmail.com
Addition:
On the month view I would even like to be able to sort the entries in a custom way - _no matter_ if they have concrete start and end times assigned!
Aug 7, 2013
#24 kell...@gmail.com
I would LOVE to see this feature implemented!  Especially for Month view!  Some of my events in my calendar have a "prioritiation" assigned to them.  I'd like to have higher priority items shows at the top and lower priority items at the bottom.
Aug 13, 2013
Project Member #25 adamrs...@gmail.com
(No comment was entered for this change.)
Labels: -Type-Enhancement Type-Feature
Aug 15, 2013
Project Member #26 adamrs...@gmail.com
 Issue 1502  has been merged into this issue.
Aug 15, 2013
Project Member #27 adamrs...@gmail.com
 Issue 1501  has been merged into this issue.
Aug 15, 2013
Project Member #28 adamrs...@gmail.com
 Issue 1727  has been merged into this issue.
Aug 18, 2013
Project Member #29 adamrs...@gmail.com
 Issue 1613  has been merged into this issue.
Aug 22, 2013
#30 thierry....@roitech.biz
Sorting of Day events by end date would be great for me. First/top event has closest deadline so should be at the top of the list.
Aug 24, 2013
Project Member #31 adamrs...@gmail.com
 Issue 1799  has been merged into this issue.
Aug 25, 2013
Project Member #32 adamrs...@gmail.com
 Issue 1922  has been merged into this issue.
Sep 29, 2013
#33 shoretra...@gmail.com
Being able to customize event order would be great for me. Is there a chance of this feature being added?
Oct 28, 2013
#34 cristien...@gmail.com
*
Nov 7, 2013
#35 dbernga...@gmail.com
I'd love to be able to drag and drop for order manually, as an option. I want to be able to use Google Calendars as a quick way to make a printable PDF calendar, but can't because I can't change the order of all-day events.
Dec 6, 2013
#36 iFl...@gmail.com
Anyone have any workarounds or patches for now?
Dec 19, 2013
#37 tomcr...@gmail.com
OK, so for the past three years people have been requesting this but so far no help? Get with it and fix this. Maybe the ability to assign a priority to each event that would determine the order it was displayed. And speaking of fixes that you have ignored, how about the "import CSV file" problems?
Jan 21, 2014
#38 craigbel...@gmail.com
Please fix this obvious problem! 

Feb 10, 2014
#39 lasu...@gmail.com
Yes, please add sort order options.

At least on events sources (multiple calendars) and all-day events vs timed events.

Thank you !

Mar 16, 2014
#40 cled...@gmail.com
How can we help with movement on this issue?  Any stack overflow post gets dead ended here.  Which is not an resolution.
Mar 17, 2014
#41 matous.k...@gmail.com
jinak cirkus problem by hrali za 6 tis - michal to resil, to asi budem mit
reprodukovanou muziku :-)
May 14, 2014
#42 hoopk...@gmail.com
Yes please add this feature.  I also have a requirement to sort by event type and I could really use this feature ASAP.
May 23, 2014
#43 srinivas...@gmail.com
I too need this requirement....YES Please...
Jun 5, 2014
Project Member #44 adamrs...@gmail.com
Here is a pull request with an implementation of this, via @axsuul:
https://github.com/arshaw/fullcalendar/pull/134
Jun 7, 2014
Project Member #45 adamrs...@gmail.com
 Issue 2066  has been merged into this issue.
Aug 7, 2014
#46 bill...@allthatjazzdance.com
I have seen this time and time again as a feature request and it has never been addressed or even commented on by Google. So if it is too hard they just ignore it?
Aug 7, 2014
#47 turbo2...@gmail.com
Ehh google has nothing to do with this code.

I resolved this issue by appending seconds onto the timestamp based on the order I want them in.
Aug 12, 2014
#48 kpj.jenk...@gmail.com
YES!!  Need to be able to drag and drop ALL DAY events into any order. Please help.
Aug 20, 2014
#49 ti08m...@gmail.com
As i needed the same (customized sorting of events) i checked the source 'fullcalendar.js' and adjusted the function 'compareSlotSegs(seg1, seg2)' like this:

function compareSlotSegs(seg1, seg2) {
	if (seg1.event.sorter != null && seg2.event.sorter != null)
		return seg1.event.sorter - seg2.event.sorter;
	else
		return seg1.start - seg2.start || // earlier start time goes first
			(seg1.event.title || '').localeCompare(seg2.event.title); // tie? alphabetically by title
}

=> You can now add a 'sorter' attribute to each event (	events.push( {
							id: v_id,
							[..]
							sorter: v_sorter}); ) which will tell the calendar in which order to show the events.
=> The logic is: If there is a 'sorter' set for events it will be taken for sorting, otherwise the events will be sorted first by starttime, 2nd by title.



Aug 20, 2014
#50 ales.fu...@gmail.com
ti08m: in what cases does your adjustment work? I just tried it for not all-day events and the compareSlotSegs() isn't even executed.
Aug 20, 2014
#51 ti08m...@gmail.com
I'm also working mainly with non all-day events.

With my adjustments in the weekly and daily overview it's ok, however in the monthly all stays as before. So it seems there is somewhere one more function for rendering the monthly events that needs some adjustments.
Aug 20, 2014
#52 ales.fu...@gmail.com
Thank you, I'm working mainly with mothly overview. I'll try to find some solution for that as well.
Aug 20, 2014
#53 ti08m...@gmail.com
Ok checked the source and here is the solution for the vertically rendered events (allday events and the events shown in the monthly overview). Change function 'compareDaySegments(a, b)' like this:

function compareDaySegments(a, b) {
	if (a.event.sorter != null && b.event.sorter != null)
		return (b.rightCol - b.leftCol) - (a.rightCol - a.leftCol) || // put wider events first
		b.event.allDay - a.event.allDay || // if tie, put all-day events first (booleans cast to 0/1)
		a.event.sorter - b.event.sorter;	//now take the sorter
	else
	return (b.rightCol - b.leftCol) - (a.rightCol - a.leftCol) || // put wider events first
		b.event.allDay - a.event.allDay || // if tie, put all-day events first (booleans cast to 0/1)
		a.event.start - b.event.start || // if a tie, sort by event start date
		(a.event.title || '').localeCompare(b.event.title); // if a tie, sort by event title
}

So if this is done in combination with the changes of here https://code.google.com/p/fullcalendar/issues/detail?id=364#c49 the calender will be ok and the events will be rendered everywhere by the event.sorter attribute.
Aug 20, 2014
#54 ales.fu...@gmail.com
Perfect, now it's working almost in all cases. I'll play with it a little bit more and find the last bugs.
Thanks a lot!
Sep 20, 2014
#55 milosziv...@gmail.com
is there a way to implement https://code.google.com/p/fullcalendar/issues/detail?id=364#c53 and https://code.google.com/p/fullcalendar/issues/detail?id=364#c49 without messing up with original fullcalendar js file.
Sep 20, 2014
#56 kpj.jenk...@gmail.com
What does thus mean to us non-techies??
Sep 29, 2014
#57 milosziv...@gmail.com
following solutions from https://code.google.com/p/fullcalendar/issues/detail?id=364#c53 does not work. I'm using version 2.*. Any help will be appreciated.
Oct 1, 2014
#58 ti08m...@gmail.com
@milo..:
With v2.0.2 (that i'm currently using) it works...
However you forgot to mention what exactly doesn't work ;)
Oct 12, 2014
#59 milosziv...@gmail.com
@ti08m...:

i've applied both codes and events behave the same. For example if i set higher priority on event1 I want it to stay above event2 who's priority is lower in case they overlap.

Events are all full-day and at least 2 days long.

I'm on v2.0.3
Oct 28, 2014
#60 miroslav...@gmail.com
compareDaySegments is not in 2.1.1 version
Oct 29, 2014
#61 ms...@filmrobot.com
It's pretty ridiculous that this absent functionality has been known for more than 4 years and nothing's been implemented for it. All of my events are multi-day, and most of them are multi-week, so in BasicWeek and BasicDay I just wind up with a stack of objects with no logic to how their organization.

I can think of reasons to organize events by colour, title, endDate, narrowest/widest first, or just the order that they're entered into the calendar. Personally, I'm going to implement the .sorter option and just set it to the row number that the event returns in from the database.

I have different queries for the different views, and if I want them sorted by Start Date, I'll just sort the database results by the column I'm using for Start Date.
Oct 30, 2014
Project Member #62 adamrs...@gmail.com
 Issue 2298  has been merged into this issue.
Nov 25, 2014
Project Member #63 adamrs...@gmail.com
 Issue 2372  has been merged into this issue.
Dec 17, 2014
#64 bernardm...@gmail.com
 https://code.google.com/p/fullcalendar/issues/detail?id=364#c53 and https://code.google.com/p/fullcalendar/issues/detail?id=364#c49 are no longer working since 2.1.1 version.

You now should have a look at the compareSegs function. For exemple I wanted to sort like this : date > duration > all day > My sorter > title.

So I changed the function like this :
function compareSegs(seg1, seg2) {
	return seg1.eventStartMS - seg2.eventStartMS || // earlier events go first
		seg2.eventDurationMS - seg1.eventDurationMS || // tie? longer events go first
		seg2.event.allDay - seg1.event.allDay || // tie? put all-day events first (booleans cast to 0/1)
		seg2.event.sorter - seg1.event.sorter || // My Sorter 
		(seg1.event.title || '').localeCompare(seg2.event.title); // tie? alphabetically by title
}

And then added a sorter attribute as in #49
Feb 9, 2015
Project Member #66 adamrs...@gmail.com
One implementation by @pcaifeng here: https://github.com/arshaw/fullcalendar/pull/212
Mar 26, 2015
#67 pedromendessk
Hi! When is this feature going to be available?

I personally don't like to change the default methods implemented in the lib because that way I can't use the minified version and with every update I must be carefull so that it all keeps working.

A custom sort on the events is one of the few things that are missing in this awsome lib!

Thanks in advance
Apr 29, 2015
#68 Bobett1...@gmail.com
This would be great. Better yet we can just allow custom sorting.

I dont remember how we get the options but you get the idea:

function compareSegs(seg1, seg2) {
	return this.options.compareSegs ? options.compareSegs(seg1, seg2) : 
	(seg1.eventStartMS - seg2.eventStartMS || // earlier events go first
		seg2.eventDurationMS - seg1.eventDurationMS || // tie? longer events go first
		seg2.event.allDay - seg1.event.allDay || // tie? put all-day events first (booleans cast to 0/1)
		seg2.event.sorter - seg1.event.sorter || // My Sorter 
		(seg1.event.title || '').localeCompare(seg2.event.title)) // tie? alphabetically by title
}
May 19, 2015
#69 dmaul...@lymanpd.com
I'm hoping this will turn up as a fix soon. Even alphabetically by event title would be great. Then I could at least manage my titles to get the list right. 
May 26, 2015
Project Member #70 adamrs...@gmail.com
 Issue 2486  has been merged into this issue.
Aug 1, 2015
#71 marc.cam...@gmail.com
Is this problem fixed?
Aug 9, 2015
#72 midwestg...@gmail.com
Another bump to see if this happens this year. It's long overdue.
Aug 22, 2015
Project Member #73 adamrs...@gmail.com
this has been released in fullcalendar v2.4.0. a new `eventOrder` setting

http://fullcalendar.io/docs/event_rendering/eventOrder/
Status: Released