0
我試圖改變日曆的顏色, 我有這樣 calender 日曆我想做的事就是這樣calender 我已經能夠添加顏色事件文本,但該事件的背景。 這是我的代碼。如何更改Fullcalendar日期字段的背景顏色?
控制器:
public function actionEvent(){
$events= \app\models\Events::find()->all();
$tasks=[];
foreach ($events as $eve){
$event = new \yii2fullcalendar\models\Event();
$event->id = $eve->id;
$event->title =$eve->event_title;
$event->start =$eve->start_date;
$event->end =$eve->end_date;
$event->backgroundColor = 'green';
$event->description=$eve->event_description ." <hr><b> Location: </b>".$eve->location." " . " <br/><b> Organizer: </b>".$eve->organizer." " ;
$tasks[] = $event;
}
return $this->render('events',['events'=>$tasks,'test'=>$tasks]);
// return $this->render('events');
}
查看:
$thame=<<<EOF
function(calEvent, jsEvent, view) {
$(this).css('background', '#DBBEBE');
}
EOF;
?>
<?= \yii2fullcalendar\yii2fullcalendar::widget(array(
'events'=> $events,
'clientOptions' => [
// 'weekends' => true,
// 'language' => 'fa',
//'eventLimit' => TRUE,
//'droppable' => true,
// 'editable' => true,
'theme'=>new JsExpression($thame),
// 'fixedWeekCount' => true,
'eventClick' => new JsExpression($ClickMe),
'defaultDate' => date('Y-m-d'),
],
));?>
誰能幫助?
究竟是如何做到這一點在Yii2工具?我是新的 – snew
@snew是否在插件中使用了任何'樣式表'。?如果它存在,那麼只需在樣式表的答案中添加樣式。 – weBBer
它只改變事件文本的背景。不是全天塊。 – snew