Open yingzzai opened 6 years ago
Hi, can you pls. make the code more readable? After a page refresh it should move back to "initial state" ;)
Thank you for your advice.
I got the data from the background, JSON format, can not be rendered on the page.
Is there any way? Even refresh, the data also appears on the page.
hmm, I think you need to call the jQuery('id').refresh() function to clear historical values?!
@yingzzai did the refresh work out?
<?php
use yii\helpers\Url; use yii\helpers\Html; use yii\web\JsExpression; use yii\web\AssetBundle; use yii\jui\JuiAsset; use app\models\Calendar; use yii\philippfrenzel\yii2fullcalendar;
/ @var $this yii\web\View / //$this->title = 'yii2 extension yii2-fullcalendar demo';
$DragJS = <<<EOF / initialize the external events -----------------------------------------------------------------/
$('#external-events .fc-event').each(function() { // store data so the calendar knows to render an event upon drop $(this).data('event', { title: $.trim($(this).text()), // use the element's text as the event title stick: true // maintain when user navigates (see docs on the renderEvent method) }); // make the event draggable using jQuery UI $(this).draggable({ zIndex: 999, revert: true, // will cause the event to go back to its revertDuration: 0 // original position after the drag }); });
EOF;
$this->registerJs($DragJS);
?>