我使用的代码与我在ActiveForm中添加的代码相同,但它不起作用:
我在gridview的filter字段中添加jui datepicker的正确方法是什么?
- <?= GridView::widget([
- 'dataProvider' => $dataProvider,'filterModel' => $searchModel,'columns' => [
- ['class' => 'yii\grid\SerialColumn'],'list_id',[
- 'attribute' => 'channel','value' => 'channel.title',],[
- 'attribute' => 'list_date','value' => 'list_date','filter' => \yii\jui\DatePicker::widget(\yii\jui\DatePicker::className(),['language' => 'ru','dateFormat' => 'dd-MM-yyyy']),'make_date',['class' => 'yii\grid\ActionColumn'],]); ?>
解决方法
您的小部件参数是错误的,您应该使用html或原始格式:
- [
- 'attribute' => 'list_date','filter' => \yii\jui\DatePicker::widget(['language' => 'ru','format' => 'html',
阅读更多关于Data Formatting.