0
我使用fullcalender与jQuery,我想知道它是否可能,如果我的数组有'bold' = true/false,
我可以使用jquery附加一个新类。使用jquery fullcalender将值附加到粗体的数据库值
$(document).ready(function() {
$('#calendar').fullCalendar({
editable: false,
allDay: false,
events: "json-events.php",
eventDrop: function(event, delta) {
alert(event.title + ' was moved ' + delta + ' days\n' +
'(You cannot update these fields!)');
},
loading: function(bool) {
if (bool) $('#loading').show();
else $('#loading').hide();
},
});
});
如果我有一个数据库值id'bold'我可以让jquery添加一个'title'样式。
$result = $dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row){
$return[]=array('id'=>$row['id'],
'title'=>$row['title'],
'start'=>$row['start'].' '.$row['time'],
'end'=>$row['end'],
'url'=>$row['url'],
'backgroundColor'=>$row['backgroundColor'],
'textColor'=>$row['textColor'],
'borderColor'=>$row['borderColor'],
'description'=>$row['description'],
"allDay" => false);
}
$dbh = null;
header('Content-type: application/json');
echo json_encode($return);
我想使用jQuery或编辑phpscript可能。但我不想编辑fullcalender.js文件。
编辑
我一直在寻找更成这样了,如果事件:“JSON-events.php”我可以补充一点,会增加大胆风格的CSS功能。
$(document).ready(function() {
$('#calendar').fullCalendar({
editable: false,
allDay: false,
events: function() {...
也许通过添加getElementById的变量,如果它是真的,让它追加样式的CSS。
这就是我所看到的理想状态。比我需要的东西还多得多。我试图在数据库中指定className,但似乎没有添加它。所以我只关注如何在主要事件中添加粗体的几件事情。 – 2012-04-18 03:07:14