基本上在datetimepicker小部件日期中首先选择时间,如何从小部件隐藏日期选项并根据时间过滤。我试过但不工作我也想隐藏删除按钮
[ 'attribute'=>'time',
'label'=>'Time',
'format'=>'raw',
'value'=>function($data){
return date('h:i:s',strtotime($data->time));
},
'filter'=> DateTimePicker::widget([
'model' => $searchModel,
'attribute' => 'time',
'clientOptions' => [
'autoclose' => true,
'format' => 'HH:ii',
'showOn' => 'button',
],
]),
'headerOptions' => ['width' => '10%', 'style' => 'text-align:center'],
],
答案 0 :(得分:0)
假设您正在使用nkovacs/yii2-datetimepicker,您可以执行此操作以仅显示时间选择器。
...
'filter'=> DateTimePicker::widget([
'model' => $searchModel,
'attribute' => 'time',
'type' => DateTimePicker::TYPE_TIME,
'clientOptions' => [
'autoclose' => true,
'format' => 'HH:ii',
'showOn' => 'button',
],
]),
...
注意'type' => DateTimePicker::TYPE_TIME,