Hi!
This is a small code that I did a while ago. I hope this helps guide you to what you want
<?php
$pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'lectivo-grid',
'dataProvider'=>$model->search(),
'cssFile'=> bUrl().'/css/gridview/gridview.css',
'filter'=>$model,
'pager' => array(
'nextPageLabel' => 'Siguiente',
'prevPageLabel' => 'Anterior',
'firstPageLabel' => 'Primero',
'lastPageLabel' => 'Ăšltimo',
'header' => '',
'maxButtonCount' => 5,
'cssFile' => bUrl().'/css/pagination/pagination.css'
),
'columns'=>array(
array(
'class'=>'CCheckBoxColumn',
),
array(
'name' => 'id_lectivo',
'header' => 'ID',
'filter'=>false,
'htmlOptions'=>array('align'=>'center')
),
'nombre',
'abreviatura',
array(
'name' => 'fec_inicio',
'value' => 'UtilFechas::aFechaNormal($data->fec_inicio)',
'htmlOptions'=>array('align'=>'center','style'=>'width: 103px;'),
'filter'=>$this->widget('zii.widgets.jui.CJuiDatepicker', array(
'model'=>$model,
'attribute'=>'fec_inicio',
'language'=>'es',
'htmlOptions'=>array('style'=>'width: 80px;'),
'options' => array(
'dateFormat' => 'yy-mm-dd',
'changeYear' => true,
'showOn' => 'button',
'buttonImage' => bUrl() . '/images/icons/calendar.png',
'buttonImageOnly' => true
)
), true),
),
array(
'name' => 'fec_fin',
'value' => 'UtilFechas::aFechaNormal($data->fec_fin)',
'htmlOptions'=>array('align'=>'center','style'=>'width: 103px;'),
'filter'=>$this->widget('zii.widgets.jui.CJuiDatepicker', array(
'model'=>$model,
'attribute'=>'fec_fin',
'language'=>'es',
'htmlOptions'=>array('style'=>'width: 80px;'),
'options' => array(
'dateFormat' => 'yy-mm-dd',
'changeYear' => true,
'showOn' => 'button',
'buttonImage' => bUrl() . '/images/icons/calendar.png',
'buttonImageOnly' => true
)
), true),
),
array(
'name' => 'estado',
'value' => '$data->estado',
'htmlOptions'=>array('align'=>'center'),
'filter'=>array('1'=>1,'0'=>0),
),
array(
'class'=>'CButtonColumn',
'header'=>CHtml::dropDownList('pageSize',
$pageSize,
array(10=>10,20=>20,50=>50),
array('onchange'=>"$.fn.yiiGridView.update('lectivo-grid',{ data:{pageSize: $(this).val() }})",)
),
),
),
'afterAjaxUpdate'=>'function(){
jQuery("#'.CHtml::activeId($model, 'fec_inicio').'").datepicker({
dateFormat: \'yy-mm-dd\',
changeYear: true,
showOn: \'button\',
buttonImage:\''.bUrl().'/images/icons/calendar.png\',
buttonImageOnly: true
});$.datepicker.setDefaults($.datepicker.regional["es"]);
jQuery("#'.CHtml::activeId($model, 'fec_fin').'").datepicker({
dateFormat: \'yy-mm-dd\',
changeYear: true,
showOn: \'button\',
buttonImage:\''.bUrl().'/images/icons/calendar.png\',
buttonImageOnly: true
});$.datepicker.setDefaults($.datepicker.regional["es"]);
}',
));
?>