hi, good morning,
I am filter gridview with the textfield mesAnio:
in _search.php:
<?php $form=$this->beginWidget('CActiveForm', array(
'action'=>Yii::app()->createUrl($this->route),
'method'=>'get',
)); ?>
<div class="row">
<?php echo $form->labelEx($model,'mesAnio'); $rango = date("Y")-4;$rango2 = date("Y")+2;?>
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker',
array(
'model'=>$model,
'attribute'=>'mesAnio',
'language'=>'es',
'options'=>array(
'dateFormat'=>'mm/yy',
'constrainInput'=>'false',
'duration'=>'fast',
'ShowAnim'=>'slide',
'changeYear' => 'true',
'changeMonth' => 'true',
'yearRange'=>$rango.':'.$rango2,
'selectOtherMonths'=>true,)
)
);
?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Buscar'); ?>
</div>
<?php $this->endWidget(); ?>
in gridview:
<?php echo CHtml::link('Busqueda Avanzada','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
'model'=>$model,
)); ?>
</div><!-- search-form -->
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'facturas-grid',
'dataProvider'=>$model->searchFacturas(),
'columns'=>array(
array(
'name'=>'razon_social',
'header'=>'Empresa',
'value'=>'$data["razon_social"]',
),
array(
'name'=>'nombre',
'header'=>'Trabajador/es',
'value'=>function($data) {
$nombre = $data["nombre"].' '.$data["apellido1"].' '.$data["apellido2"];
return $nombre;
},
),
),
));?>
I am trying to capture mesAnio in the controller
in controller:
public function actionAdmin()
{
$model=new Facturas('busquedaAvanzada');
$model->unsetAttributes(); // clear any default values
$model->obtenerSumasImportes(null,$model);
// $model->obtenerSumasImportes(null);
if(isset($_GET['Facturas']))
{
$model->attributes=$_GET['Facturas'];
}
$this->render('admin',array(
'model'=>$model,
));
}
I need to capture mesAnio in the controller by with $_GET, Someone can help me?