philippfrenzel / yii2fullcalendar

JQuery Fullcalendar Yii2 Extension
GNU General Public License v2.0
132 stars 95 forks source link

How to use fullcalendar with pjax #121

Closed ademmer closed 6 years ago

ademmer commented 6 years ago

Hi,

I'm trying to use the widget with pjax, but I have no clue how to do so.

This is what I did so far:

Pjax::begin(['id' => "kalender", 'timeout' => false, 'enablePushState' => true]);
    echo \yii2fullcalendar\yii2fullcalendar::widget([
        'options' => [
            'id' => 'calendar',
            'lang' => 'de',
        ],
        'header' => [
            'left' => '',
            'center' => 'title,prev,today,next',
            'right' => '',
        ],
        'clientOptions' => [
            'selectable' => true,
            'selectHelper' => true,
            'select' => new JsExpression($JSCode),
            'eventClick' => new JsExpression($JSEventClick),
        ],
        'events' => \yii\helpers\Url::to(['/urlaub/mitarbeiterevents'])]);
Pjax::end();

What else is needed to make it work?

ademmer commented 6 years ago

so I figured it out. needed to set the timeout to an acceptable number an not false :) now I can trigger the reload with $.pjax({url: 'mitarbeiterkalender', container:"#kalender"});

philippfrenzel commented 6 years ago

@ademmer thanks for shareing the solution!

ademmer commented 6 years ago

my pleasure :)

and after testing this for a time I must say, it doesn't work properly. So I canceled this approach. Without pjax I just call $('#calendar').fullCalendar('refetchEvents'); This works perfectly!