0
嗨,大家好,我在我的項目中使用this extension,我遇到了ajaxEvents
問題,我想知道我在這裏做什麼錯?這裏是我的視圖文件和控制器動作Yii2完整日曆AjaxEvents不能正常工作
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?= yii2fullcalendar::widget([
'events' => $events,
'options' => [
'language' => 'en',
'eventLimit' => 2,
],
'ajaxEvents' => \yii\helpers\Url::to(['/jsoncalendar'])
]);
?>
</div>
</div>
</div>
這裏的代碼在控制器代碼
public function actionJsoncalendar($start=NULL,$end=NULL,$_=NULL){
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
$times = Event::find()->where(1)->all();
$events = array();
foreach ($times AS $time){
//Testing
$Event = new \yii2fullcalendar\models\Event();
$Event->id = $time->id;
$Event->title = $time->title;
$Event->start = $time->start_time;
$Event->end = $time->end_time;
$events[] = $Event;
}
return $events;
}
使用eventLimit
也試過,但多數民衆贊成在不工作或者
請提供鏈接,擴展您正在使用。 – arogachev
@arogachev添加了鏈接 –
在'ajaxEvents'中指定了只包含動作名稱的url,您是否試圖像在README中提到的那樣使用控制器/模塊ID來指定它:''ajaxEvents'=> Url :: to([ /時間軌跡/默認/ jsoncalendar'])'? – arogachev