Exemple #1
0
?>

    <p>
        <?php 
echo Html::a('บันทึกข้อมูลใหม่', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
$columns = [['attribute' => 'id', 'width' => '30px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'date', 'filterType' => GridView::FILTER_DATE, 'format' => 'raw', 'width' => '150px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'hn', 'width' => '100px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'depart', 'filter' => \app\models\Acs::itemsAlias('depart'), 'value' => function ($model) {
    return $model->departName;
}, 'width' => '120px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'fullName', 'headerOptions' => ['style' => 'text-align:center'], 'width' => '160px'], ['attribute' => 'sex', 'filter' => \app\models\Acs::itemsAlias('sex'), 'value' => function ($model) {
    return $model->sexName;
}, 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center', 'width' => '80px'], ['attribute' => 'age', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'time2hos', 'headerOptions' => ['style' => 'text-align:center']], ['attribute' => 'result_ekg', 'filter' => \app\models\Acs::itemsAlias('resultekg'), 'value' => function ($model) {
    return $model->ResultEkgName;
}, 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center', 'width' => '130px'], ['attribute' => 'diagnosis', 'filter' => \app\models\Acs::itemsAlias('diagnosis'), 'value' => function ($model) {
    return $model->diagnosisName;
}, 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center', 'width' => '140px'], ['attribute' => 'result', 'headerOptions' => ['style' => 'text-align:center'], 'filter' => \app\models\Acs::itemsAlias('result'), 'value' => function ($model) {
    return $model->resultName;
}, 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center', 'width' => '140px'], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => false, 'vAlign' => 'middle', 'template' => '{view} {update} {delete}', 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['view', 'id' => $model->id], ['title' => 'ดูรายละเอียด', 'data-toggle' => 'tooltip']);
}, 'update' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['update', 'id' => $model->id], ['title' => 'แก้ไขรายละเอียด', 'data-toggle' => 'tooltip']);
}, 'delete' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete', 'id' => $model->id], ['title' => 'ลบรายการ', 'data-toggle' => 'tooltip', 'data-method' => 'post', 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?')]);
}]]];
echo DynaGrid::widget(['columns' => $columns, 'storage' => DynaGrid::TYPE_SESSION, 'theme' => 'panel-default', 'enableMultiSort' => false, 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'hover' => true, 'panel' => ['heading' => '<h3 class="panel-title">รายการ</h3>', 'before' => '{dynagrid}']], 'options' => ['id' => 'dynagrid-1'], 'showSort' => false]);
?>

</div>