將fullCalendar.js與defaultView一起用作agendaDay,並將事件作爲JSON從mysql獲取。錯誤是它顯示'全天'部分中的事件。fullCalendar.js defaultView:'agendaDay'顯示全天節中的事件
我嘗試這樣做:
eventRender: function(event, element, view) {
if (event.allDay == 1) {
event.allDay = true;
} else {
event.allDay = false;
}
我也試過:
eventRender: function(event, element, view) {
event.allDay = false;
},
而且這樣的:
eventAfterAllRender: function(event, element, view) {
event.allDay = false;
},
但我的股票,仍然沒有工作。
這裏沒有JSON工作小提琴:事件:
http://jsfiddle.net/sebababi/g5gtG/1/
要進行測試,您需要更改的事件:在對的jsfiddle:事件: 「events.php」,
這裏是events.php文件
<?php
// List of events
$json = array();
// Query that retrieves events
$requete = "SELECT * FROM evenement ORDER BY id";
// connection to the database
try {
$bdd = new PDO('mysql:host=localhost;dbname=fullcalendar', 'root', 'root');
} catch(Exception $e) {
exit('Unable to connect to database.');
}
// Execute the query
$resultat = $bdd->query($requete) or die(print_r($bdd->errorInfo()));
// sending the encoded result to success page
echo json_encode($resultat->fetchAll(PDO::FETCH_ASSOC));
?>
,這裏是mysql表
CREATE TABLE `evenement` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8_bin NOT NULL,
`start` datetime NOT NULL,
`end` datetime DEFAULT NULL,
`url` varchar(255) COLLATE utf8_bin NOT NULL,
`allDay` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=34 ;
INSERT INTO `evenement` (`id`, `title`, `start`, `end`, `url`, `allDay`) VALUES
(24, 'testing defaultView with agendaDay and JSON event', '2014-01-07 08:30:00', '2014-01-07 09:30:00', '', 1);
任何幫助讓我走在正確的軌道將不勝感激。
您可以在瀏覽器控制檯中顯示您返回的JSON。 –
我可以在你的jsfiddle中看到呈現的事件「not in allDay slot」,你可以編輯你的問題並在瀏覽器控制檯中發佈你的返回的JSON。 –
@亨利克C.嗨恩裏克,這裏是JSON:http://eggings.com/fullcalendar-1.6.4/events.php,這裏的代碼在行動:http://eggings.com/fullcalendar-1.6.4 /default.php。因此,在第一次加載時,您會在全天區域看到該事件。如果您點擊「月」然後點擊「日」,該活動就位於正確的位置。感謝 – Sebastian