javascript - array for full calendar -
how should array if want serialize , use in full calendar?
(int) 1 => [ 'start_date' => '2016-06-01', 'end_date' => '2016-06-01' ], (int) 2 => [ 'start_date' => '2016-06-02', 'end_date' => '2016-06-02' ], (int) 3 => [ 'start_date' => '2016-06-03', 'end_date' => '2016-06-03' ], (int) 4 => [ 'start_date' => '2016-06-04', 'end_date' => '2016-06-04' ], (int) 5 => [ 'start_date' => '2016-06-05', 'end_date' => '2016-06-05', 'events' => [ (int) 0 => [ 'date' => 'e', 'name' => 'holliday' ], (int) 4 => [ 'date' => 'e', 'name' => 'holliday' ] ] ]
this array , use json_encode send view use on events: seems not working...
<script type="text/javascript"> $(document).ready(function() { // instantiate fullcalendar // ================================ var date = new date(), d = date.getdate(), m = date.getmonth(), y = date.getfullyear(); var jdata = $("#jsondata").html(); $("#full_calendar").fullcalendar({ header: { left: "prev,next", center: "title", right: "today,month,agendaweek" }, buttontext: { prev: "<", next: ">" }, editable: true, events:jquery.parsejson(jdata), eventclick: function (calevent, jsevent, view) { // content var pcontent = ''; pcontent += '<h5 class=semibold>'; pcontent += '<img class="mr10" src="/adminre1.2/image/icons/bloggingservices.png" width="42" height="42" />'; pcontent += calevent.title; pcontent += '</h5>'; pcontent += '<hr/>'; pcontent += '<p><span class="ico-clock"></span> start: '; pcontent += $.fullcalendar.moment(calevent.start).format(); pcontent += '</p>'; if (calevent.end !== null) { pcontent += '<p><span class="ico-clock"></span> end: '; pcontent += $.fullcalendar.moment(calevent.end).format(); pcontent += '</p>'; } // bootstrap popover $(this).popover({ placement: 'auto', container: 'body', html: true, trigger: 'manual', content: pcontent }).popover('toggle'); } }); });
<div id='jsondata' style="display:none;"><?php echo $results; ?></div>
this javascript
in official documentation example case: fullcalendar events array
the event object has start , end properties, not start_date , end_date. .
Comments
Post a Comment