Пример #1
0
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="cals-index1">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('<i class="glyphicon glyphicon-plus"></i> เพิ่มข้อมูล', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\ExpandRowColumn', 'value' => function ($model, $key, $index, $column) {
    return GridView::ROW_COLLAPSED;
}, 'detail' => function ($model, $key, $index, $column) {
    $searchModel = new CalitemsSearch();
    $searchModel->cal_id = $model->id;
    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
    return Yii::$app->controller->renderPartial('_calitem', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
}], ['attribute' => 'caldate', 'value' => 'caldate', 'format' => 'raw', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'caldate', 'options' => ['placeholder' => 'ระบุวันที่ ...'], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]]), 'headerOptions' => ['class' => 'text-left', 'style' => 'width: 250px;']], 'by', 'remark', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Пример #2
0
 /**
  * Lists all Calitems models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new CalitemsSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }