如何在yii2中从Datepicker隐藏日期菜单

时间:2015-07-02 05:48:21

标签: javascript jquery yii2 datetimepicker

基本上在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'],

        ],

1 个答案:

答案 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,