添加eventRender时,为什么我的完整日历事件会消失?

时间:2015-11-20 15:40:37

标签: jquery calendar fullcalendar

我是全日历的新手。我下载了所有最新的文件,并做了一个测试活动,一切正常。但是,当我在代码中添加了eventRender时,我的事件从日历中消失了。

<?php
$db_hostname = 'localhost';
$db_username = 'my username';
$db_password = 'my pass';
$db_database = 'demo';

// Database Connection String
$con = mysql_connect($db_hostname,$db_username,$db_password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db($db_database, $con);
?>

 <!DOCTYPE html>
  <html lang="en">
  <head>
    <meta charset="utf-8" />
    <title></title>
   </head>
   <body>
   <form action="demo.php" method="post"/>

   <p>imei: <input type="text" name="input1"/> </p>

 <select name="input2">
   <option value="1">111111111111111111111</option>
    <option value="2">222222222222222222</option>
     <option value="3">33333333333333333</option>
        <option value="4">4444444444444444</option>
   </select>

  <br>
  <br>

<input type="image" src="submit.png" alt="Submit Form" />
</form>
<br>
<form action="form.php" method="post"> 
<input type="text" name="term" /><br /> 
<input type="submit" value="Submit" /> 
</form> 

<?php
if (!empty($_REQUEST['term'])) {

$term = mysql_real_escape_string($_REQUEST['term']);     

$sql = "SELECT * FROM demeo WHERE Description LIKE '%".$term."%'"; 
$r_query = mysql_query($sql); 

while ($row = mysql_fetch_array($r_query)){  
echo 'Primary key: ' .$row['PRIMARYKEY'];  
echo '<br /> Code: ' .$row['input1'];  
echo '<br /> Description: '.$row['input2'];  

}  

}
?>
</body>
</html>

如果我删除eventRender,事件将返回日历。我在这里做错了什么?

1 个答案:

答案 0 :(得分:1)

您是否检查过控制台是否有错误?您可能不包括qtip / qtip2 js库,这将导致事件发生错误。演示:no qtip included vs has qtip lib

$('#calendar').fullCalendar({
    events: [
        {
            title: 'My Event',
            start: '2015-11-20',
            description: 'This is a cool event'
        }
        // more events here
    ],
    eventRender: function(event, element) {
        element.qtip({ /* qtip is not included with fullcalendar */
            content: event.description
        });
    }
});