My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 469: Limit number of displayed events per day
2 people starred this issue and may be notified of changes. Back to list
Status:  Duplicate
Merged:  issue 304
Owner:  ----
Closed:  Jun 2010


Sign in to add a comment
 
Reported by jessd...@gmail.com, Apr 29, 2010
Is there a way to limit the number of displayed events per day in month
view? If I add 20-30 events per day it seems that the cal displays all of
them and makes it very big. Can I somehow configure the behaviour of that
view ?

Ty in advance!

John

May 7, 2010
#1 marcin.m...@gmail.com
There is a solution. In event trigger you should specify the number of events you
want to display in month view.
Here is the code that may give you an idea how to achieve this.

events: function(start, end, callback) {
  render_view = $calendar.fullCalendar("getView");
  $.getJSON(ajaxschedule,
	{
        start: startdate,
	end: enddate,
        id: id,
	action: 'get_schedule'
	},
	function(result) {
          if(result == null || result == '')
		calevents = '[]';
	  else {
                calevents = eval(result);
                if(render_view.name == 'month') {
		   k = 0;
                   // here you set the maximum number of events you want in month view
                   var max_events = 3;
                   caleventsTemp = new Array();
                   for(i = 0; i < max_events; i++) {
		      caleventsTemp[k] = calevents[i];
		      k++;
		   }
                calevents = caleventsTemp;
	     }
	 }
         callback(calevents);
     });
}

The loop that makes number of events smaller will only work in month view, so you can
just put that loop in your code easily.
You can also pass the argument in your json to the server (eg. month_view = true or
false - specified on the view name) and thanks to that get from your database as many
events as you want.

Hope this helps.
May 8, 2010
#2 jessd...@gmail.com
Thanks Marcin!

Did the second suggestion in the mean time which pushed back server load a much! ;)
May 10, 2010
#3 engabuo...@gmail.com
marcin.milinski, I don't think your solution works, rendering happens sometimes without the need to fetch data 
from server, for example when moving from month view to week view, with your solution the week view will not 
contain all events, because the events function doesn't get called when moving from month view to week view, 
the events are already there.
May 10, 2010
#4 jessd...@gmail.com
Not really! :) Set the lazyFetching option to false. This will force the calendar to 
reload every event. 

"The calendar  will fetch events any time the view is switched, or any time the current 
date changes..."

http://arshaw.com/fullcalendar/docs/event_data/lazyFetching/
Jun 16, 2010
Project Member #5 adamrs...@gmail.com
a more... link seems like it'd be the best solution. merging...
Status: Duplicate
Mergedinto: 304
Sign in to add a comment

Powered by Google Project Hosting