Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding horizontal scroll to fullcalendar scheduler

I am using Fullcalendar Scheduler, and the problem is when i have many resources, it becomes not good, like this: fullcalendar scheduler  problem

The live demo with litle resources: http://fullcalendar.io/js/fullcalendar-scheduler-1.3.3/demos/vertical-resource-view.html

I have an idea, it's adding an horizontal scroll, but i don't know the way, can you guys help me out ? Thank you very much and have a great day.

like image 258
Duy Hoang Avatar asked Aug 24 '16 18:08

Duy Hoang


People also ask

What is FullCalendar scheduler?

FullCalendar Premium (also known as “FullCalendar Scheduler”) is a collection of plugins released under a different license than the standard plugins. Each plugin offers additional functionality: Timeline View - display a large number of resources, with dates/times spanning horizontally.

What is FullCalendar JavaScript?

FullCalendar is a full-sized drag & drop event calendar. This packages is an easily consumable combination of standard plugins. It makes the root namespace available as the FullCalendar browser global.

What is the use of FullCalendar?

FullCalendar generates real React virtual DOM nodes so you can leverage Fiber, React's highly optimized rendering engine.


2 Answers

Use the combination of this configure options :

dayMinWidth: 150,
stickyFooterScrollbar : true,
  • dayMinWidth : guarantees your horizontal titles are visible.
  • stickyFooterScrollbar : guarantees horizontal scrollbar is visible.
like image 105
Roberto Peribáñez Iglesias Avatar answered Sep 25 '22 13:09

Roberto Peribáñez Iglesias


Paresh's answer works for views with many columns, but has the limitation that views with few columns will have very wide columns.

Fullcalendar's render algorithm calculates equal column widths based on the view width, and there doesn't appear to be a simple way of setting the column widths using CSS.

Instead we need to enable scrolling on the x-axis:

.fc-view-container { 
    overflow-x: scroll; 
}

then use jQuery to calculate the overall width of the view. Here I am using a minimum column width of 100px:

var columnCount = $('.fc-agendaDay-view th.fc-resource-cell').length;
var viewWidth = $('.fc-view-container').width();
var minViewWidth = 18 + columnCount * 100;
if (minViewWidth > viewWidth) {
    $('.fc-view.fc-agendaDay-view.fc-agenda-view').css('width', minViewWidth + 'px');
}

We only change the width of the view and enable scrolling if it exceeds the current width of the view. This has the effect of setting a minimum column size of 100px.

The jQuery needs to run after the calendar.render(); call.

like image 23
orangutangle Avatar answered Sep 24 '22 13:09

orangutangle