Filtros
Versión 2 (Guillermo Zdanowicz, 22/03/2016 23:47) → Versión 3/9 (Guillermo Zdanowicz, 22/03/2016 23:48)
h1. Filtros
en seccion required del composer
<pre>
“kartik-v/yii2-date-range”: “dev-master”
</pre>
en models/comprasSearch.php
$public $rango_fecha;
<pre>
public function rules()
[['descripcion', 'fecha_factura', 'fecha_recepcion', 'imputacion_compra', 'comprobante', 'modo_pago', 'rango_fecha', 'fecha_desde', 'fecha_hasta'], 'safe'],
</pre>
en /views/compras/index.php
<pre>
use kartik\daterange\DateRangePicker;
</pre>
<pre>
[
'attribute' => 'rango_fecha',
'value' => 'fecha',
'format'=>'raw',
'options' => ['style' => 'width: 25%;'],
'filter' => DateRangePicker::widget([
'model' => $searchModel,
'attribute' => 'rango_fecha',
'useWithAddon'=>false,
'convertFormat'=>true,
'pluginOptions'=>[
'locale'=>['format'=>'Y-m-d']
],
])
],
</pre>
en seccion required del composer
<pre>
“kartik-v/yii2-date-range”: “dev-master”
</pre>
en models/comprasSearch.php
$public $rango_fecha;
<pre>
public function rules()
[['descripcion', 'fecha_factura', 'fecha_recepcion', 'imputacion_compra', 'comprobante', 'modo_pago', 'rango_fecha', 'fecha_desde', 'fecha_hasta'], 'safe'],
</pre>
en /views/compras/index.php
<pre>
use kartik\daterange\DateRangePicker;
</pre>
<pre>
[
'attribute' => 'rango_fecha',
'value' => 'fecha',
'format'=>'raw',
'options' => ['style' => 'width: 25%;'],
'filter' => DateRangePicker::widget([
'model' => $searchModel,
'attribute' => 'rango_fecha',
'useWithAddon'=>false,
'convertFormat'=>true,
'pluginOptions'=>[
'locale'=>['format'=>'Y-m-d']
],
])
],
</pre>