-2

回答

php composer.phar 需要 kartik-v/yii2-widget-datepicker "@dev"

我想按日期范围过滤 GridView::widget

但我收到错误“找不到类 'DateRangePicker'”

Helpres 没有找到这个模块

   [
                                                'attribute' => 'Date',
                                                'label' => 'Data',

                                                'value' => function ($model, $key, $index, $column) {
                                                    return $model->create_at;
                                                },
                                                'filter' => DateRangePicker::widget([
                                                                                            'model'=>$searchModel,
                                                                                            'attribute' => 'createdAt',
                                                                                            'pluginOptions'=> [
                                                                                                    'locale'=>['format' => 'Y-m-d'],
                                                                                                    "opens"=>"left",
                                                                                            ]
                                                                               ])
                                        ]

如何按日期范围正确过滤?

4

1 回答 1

0

你需要安装这个包

php composer.phar require kartik-v/yii2-date-range "dev-master"

并添加use kartik\daterange\DateRangePicker;

于 2020-10-30T06:14:59.253 回答