我正在尝试在我的 Gridview 中设置 Kartik Editable。我正在尝试使用具有选项的Editable::INPUT_DROPDOWN_LIST取决于来自另一列的数据
我在 column 中设置了 Editable ID Ket.
,下拉列表的选项取决于 column 中的值Kode Jenis
。
这是我网格中的代码
['class' => 'kartik\grid\EditableColumn',
'attribute' => 'id_keterangan_tambahan',
'vAlign' => 'middle',
'headerOptions' => ['class' => 'kv-sticky-column'],
'contentOptions' => ['class' => 'kv-sticky-column'],
'editableOptions' => [
'data' =>
[
function ($model, $key, $index, $widget) {
$kode_jenis = $model->kode_jenis;
switch ($kode_jenis) {
case "07":
$t = [
1 => '1',
2 => '2',
3 => '3',
4 => '4',
5 => '5',
6 => '6'
];
break;
case "08":
$t = [
1 => '1',
2 => '2',
3 => '3',
4 => '4',
];
break;
default:
$t = [
0 => '0',
];
break;
}
return $t;
},
],
'options' => ['class' => 'form-control', 'prompt' => 'Select ID...'],
'displayValueConfig' => [
'0' => '0 <i class="glyphicon glyphicon-ok" style="color: green"></i>',
'9' => '- <i class="glyphicon glyphicon-remove" style="color: #ff0000"></i>',
],
'header' => 'ID Keterangan Tambahan',
'size' => 'md',
'inputType' => Editable::INPUT_DROPDOWN_LIST,
'widgetClass' => 'kartik\datecontrol\DateControl',
'options' => [
'type' => Editable::INPUT_DROPDOWN_LIST,
'options' => [
'pluginOptions' => [
'autoclose' => true
]
]
]
],
],
[
'attribute' => 'kode_jenis',
'value' => function($data) {
return $data->kode_jenis;
},
'hAlign' => 'center',
'width' => '175px',
],
下拉菜单仅显示 Kode Jenis 的选项07 or 08
。
但我得到了这样的错误
htmlspecialchars() 期望参数 1 是字符串,给定对象