Per esempio, ho un solo campo per filtro. È un intervallo di date con due input e widget di calendario non funzionanti.
In considerazione:
<div class="col-md-4 col-md-offset-8">
<?php echo $this->render('_filter', [
'model' => $filterModel
]); ?>
</div>
<div class="col-md-12">
<?php Pjax::begin(['id' => 'order-statistics']); ?>
<?php echo GridView::widget([
'dataProvider' => $dataProvider,
'filterSelector' => '#filter-form .js-date-value',
'showFooter' => true,
'columns' => [
In _filter.php:
$this->registerAssetBundle(DateRangePickerAsset::className());
<?php echo Html::beginTag('div', ['id' => 'filter-form']); ?>
<div class="input-group">
<span class="input-group-addon js-date-calendar" title="<?php echo Yii::t('statistics', 'Select date'); ?>"
role="button" data-max-date="<?php echo date('Y-m-d', strtotime('+1 day')); ?>">
<?php echo Html::icon('calendar', ['tag' => 'i']); ?>
</span>
<?php echo Html::activeTextInput($model, 'from', [
'id' => 'js-date-from',
'class' => 'form-control js-date-from js-date-value',
'readonly' => true
]); ?>
<span class="input-group-addon js-date-remove" title="<?php echo Yii::t('statistics', 'Clear fields'); ?>"
role="button">
<?php echo Html::icon('remove', ['tag' => 'i']); ?>
</span>
<?php echo Html::activeTextInput($model, 'to', [
'id' => 'js-date-to',
'class' => 'form-control js-date-to js-date-value',
'readonly' => true
]); ?>
</div>
<?php echo Html::endTag('div');
http://www.yiiframework.com/doc-2.0/yii-grid-gridview.html#$filterSelector-detail questo sicuramente ti aiuterà –