Created
September 9, 2016 03:15
-
-
Save melaniecarr23/39a457b862065c78aaf7ded840a3bbcd to your computer and use it in GitHub Desktop.
PHP: Yii2 kartik editable patientID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // patient dropdown editable column | |
| [ | |
| 'class' => 'kartik\grid\EditableColumn', | |
| 'attribute' => 'patientID', | |
| 'pageSummary' => true, | |
| 'width' => '100px', | |
| // filtering grid | |
| 'filterType'=>GridView::FILTER_SELECT2, | |
| 'filter'=>ArrayHelper::map(Patient::find()->where(['active_patient'=>1])->orderBy('Nickname')->asArray()->all(), 'ID', 'Nickname'), | |
| 'filterWidgetOptions'=>[ | |
| 'pluginOptions'=>['allowClear'=>true], | |
| ], | |
| 'filterInputOptions'=>['placeholder'=>'- Patient -'], | |
| // end filtering grid | |
| 'editableOptions'=> function ($model, $key, $index, $widget) { | |
| $patients = ArrayHelper::map(Patient::find()->where(['active_patient'=>1])->orderBy('Nickname')->asArray()->all(),'ID','Nickname'); | |
| return [ | |
| 'header' => 'Patient', | |
| 'attribute' => 'patientID', | |
| 'size' => 'sm', | |
| 'inputType' => 'dropDownList', | |
| 'displayValueConfig' => $patients, | |
| 'data' => $patients | |
| ]; | |
| } | |
| ], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment