【问题标题】:Yii2 FullCalendar: how to add link buttonYii2 FullCalendar:如何添加链接按钮
【发布时间】:2017-01-04 10:56:20
【问题描述】:

我正在使用FullCalendar,它工作得很好,但是当我点击重定向查看页面时,我需要将 href 添加到按钮 className='btn' 。

我在控制器中的代码:

public function actionIndex()
{
   $events = event::find()->all();
   $taskes=[];
   foreach ($events as $eve) 
   {
      $event1 = new \yii2fullcalendar\models\Event();
      $patient = patient::findOne($eve->patient_id);
      $event1->className='btn'; // this button that i need to add link to :  ['site/view', 'id' => $id ]  
      $event1->id = $eve->id;
      $event1->title = $patient->patient_name;
      $event1->start = $eve->event_date;
      $taskes[] = $event1;
   }
      return $this->render('index', [
      'events'=>$taskes,
    ]);
}

【问题讨论】:

    标签: php html yii2 fullcalendar yii2-advanced-app


    【解决方案1】:

    我觉得你可以这样:

    ...
    $event1->url = Url::to(['site/view', 'id' => $id ]);
    ...
    

    查看文档 - http://fullcalendar.io/docs/event_data/Event_Object/

    【讨论】:

    • 非常感谢..我试过了,它可以按我的意愿工作,非常感谢您的帮助... :)
    猜你喜欢
    • 2011-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多