Yii2-Fullcalendar – Update Event

Previously I had written a post regarding how to create FullCalendar plugin in an Yii2 Framework application.  In this tutorial we will show you how to update events in FullCalendar plugin in an Yii2.


Package is although registered at packagist.org – so you can just add one line of code, to let it run!

add the following line to your composer.json require section:


or run:

$ php composer.phar require philippfrenzel/yii2fullcalendar "*"

And ensure, that you have the following plugin installed global:

php composer.phar global require “fxp/composer-asset-plugin:~1.0”


After complete Yii2-Fullcalendar Part-1 and Part-2, proceed to following.

Yii2 Fullcalendar - Update


In index.php

<?= \yii2fullcalendar\yii2fullcalendar::widget(array(
            'events' => $events,
            'id' => 'calendar',
            'clientOptions' => [
                'editable' => false,
                'draggable' => false,
            'eventClick' => "function(calEvent, jsEvent, view) {

                $(this).css('border-color', 'red');

                $.get('index.php?r=calendar/update',{'id':calEvent.id}, function(data){

Triggered when the user clicks an event.

function( event, jsEvent, view ) { }

event is an Event Object that holds the event’s information (date, title, etc).

jsEvent holds the native JavaScript event with low-level information such as click coordinates.

view holds the current View Object.

eventClick will not be triggered for background events.



public function actionUpdate($id)
        $model = $this->findModel($id);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['view', 'id' => $model->category_id]);
        } else {
            return $this->renderAjax('update', [
                'model' => $model,



Prakash S

Prakash S

I would like to introduce myself as a Software professional opting for the career in software industry. I'm Prakash S, a MCA graduate and trained as industry level practice for Software technology. Basically I am a PHP Developer but now days exploring more in HTML5, CSS, AngularJS and jQuery libraries.