dongnuan7956 2011-01-01 16:15
浏览 66
已采纳

未在fullCalendar中显示的事件

I want to add some Events after the fullCalendar object is create... I'm working with PHP and JavaScript.

I have create fullCalendar object and after i want to add some events.

Here is the PHP code:

  function BuildEvents() { 
    // Showing the calendar 
    echo '<div id="fCald"></div>';

   // Events building
   $evJSON = json_encode(array(
      array('title' => "Evt.1", 
           'start' => "2010-12-22", 
       'url' => "#"),
      array('title' => "Evt.2", 
       'start' => "2011-01-15", 'end' => "2011-01-19",
       'url' => "http://yahoo.com/")
   ));

   // Adding Events to object
   $fCal = '$("#fCald").fullCalendar("addEventSource", '.$evJSON.')';

   //Final showing      
   echo '<script type="text/javascript">'.
        'eval('.$fCal.');'.
        '</script>';
}

When PHP function is call, the JSON array is OK, but the events are not showing on the calendar...

I also test this code:

$fCal = '$("#fCald").fullCalendar("renderEvent", '.$evJSON.', true)';

and this is not working to...

I don't understand how to display events after building the fullCalendar object.

Thanks.

Luc M.

  • 写回答

1条回答 默认 最新

  • duandong2562 2011-01-01 19:22
    关注

    There's an easy/straight forward example in the plugin page:

    $(document).ready(function() {
        $('#calendar').fullCalendar({
            editable: true,
            events: "json-events.php",
            eventDrop: function(event, delta) {
                alert(event.title + ' was moved ' + delta + ' days
    ' +
                    '(should probably update your database)');
            },
            loading: function(bool) {
                if (bool) $('#loading').show();
                else $('#loading').hide();
            }
        });
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?