Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to combine multiple event data into one object or variable suitable for use with fullcalendar?
    text
    copied!<p>I am getting data from a DB for populating events in fullcalendar.js I get this information prior to initiating <code>$('#calendar').fullCalendar({})</code></p> <p>If I knew how many events I was going to have I could create the calendar with the code below</p> <pre><code>events: [ eventz[0], eventz[1] ] </code></pre> <p>Where eventz contain information like</p> <pre><code>eventz[eventcounter]={ className: title[counter], title: title[counter], start: new Date(y, m, weekday, result[hour1], result[minute1]), end: new Date(y, m, weekday, result[hour2], result[minute2]), allDay: false }; </code></pre> <p>EDIT: More information-events would normally contain information written like below </p> <pre><code>events:[ {//event1 title: 'TENTATIVE', start: new Date(y, m, monday, 0, 30), end: new Date(y, m, monday, 1, 0), allDay: false }, {//event2 title: 'TENTATIVE', start: new Date(y, m, monday, 0, 30), end: new Date(y, m, monday, 1, 0), allDay: false } ] </code></pre> <p>Unfortunately, I don't know how many events I'm going to get. I thought that prior to initiating the calendar, I could combine the events into one object or variable (something like the code below-where <code>allevents={eventz[0]},{eventz[1]}</code>).</p> <pre><code>events: [ allevents ] </code></pre> <p><strong>QUESTIONs</strong></p> <p>Is it possible to combine events into one object or variable like above? If yes, how? If no, I'd be interested in alternative methods for entering dynamic event data into fullcalendar. Thanks :)</p> <p><strong>WHAT I have tried</strong></p> <pre><code>//combine all events into one for (var i=0;i&lt;=counter;i++) { allevents+=eventz[i]; if (i!=counter) { allevents+=','; } } </code></pre> <p>I've tried quite a few things, but this feels like I'm doing ridiculous stuff and this seems like an easy question (for people other than me).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload