Hola a todos
El problema es el siguiente: en el index tengo un dropDownList y 2 CJuiDatePicker donde el usuario llenar y tengo un CHtml::ajaxSubmitButton donde envío a una acción los datos antes mencionados y desde allí renderizo un CJuiDialog
y muestro cgridview con los datos. En el momento que quiero avanzar página o filtrar por las columnas me muestra un
error PHP[8] undefined index
en la vista index.php
<H4>Aprobación de cheques</H4>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'AprobacionCheques-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<p class="note">Los campos con <span class="required">*</span> son obligatorios.</p>
<?php echo $form->errorSummary($model); ?>
<table style="background-color: #d0dafd">
<tr>
<td colspan="2">
<div align="center" class="row">
<?php echo $form->labelEx($model,'idbanco_cta'); ?>
<?php
$htmlOptions = array(
'empty'=>'-- Seleccione la cuenta bancaria --',
'style'=>'width: 500px;',
);
echo $form->dropDownList($model,'idbanco_cta',$model->getListaCuentaBancarias(),$htmlOptions); ?>
<?php echo $form->error($model,'idbanco_cta'); ?>
</div>
</td>
</tr>
<tr>
<td>
<div align="center" class="row">
<?php echo $form->labelEx($model,'fec_desde'); ?>
<?php $this->widget("zii.widgets.jui.CJuiDatePicker",array(
"attribute"=>"fec_desde",
"model"=>$model,
"language"=>"es",
"options"=>array(
"dateFormat"=>"yy-mm-dd",
'changeMonth' => 'true',
'changeYear' => 'true',
'showButtonPanel'=>true,
),
'htmlOptions'=>array(
'size'=>10,
'maxlength'=>10
),
)); ?>
<?php echo $form->error($model,'fec_desde'); ?>
</div>
</td>
<td>
<div align="center" class="row">
<?php echo $form->labelEx($model,'fec_hasta'); ?>
<?php $this->widget("zii.widgets.jui.CJuiDatePicker",array(
"attribute"=>"fec_hasta",
"model"=>$model,
"language"=>"es",
"options"=>array(
"dateFormat"=>"yy-mm-dd",
'changeMonth' => 'true',
'changeYear' => 'true',
),
'htmlOptions'=>array(
'size'=>10,
'maxlength'=>10
),
)); ?>
<?php echo $form->error($model,'fec_hasta'); ?>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div align="center" class="row">
<?php echo CHtml::ajaxSubmitButton('Filtrar',
$this->createUrl('report'),
array(
'onclick'=>'$("#DialogFilter").dialog("open")',
'update'=>'#DialogDiv'
),
array('class'=>"row-button","id"=>'filtrar-chq')
); ?>
</div>
</td>
</tr>
</table>
<?php $this->endWidget(); ?>
</div><!-- form -->
<div id="DialogDiv"></div>
En el Controlador
public function actionReport()
{
$id = $_POST['Aprobacion']['idbanco_cta'];
$fecDsd = $_POST['Aprobacion']['fec_desde'];
$fecHst = $_POST['Aprobacion']['fec_hasta'];
//
$model=new CActiveDataProvider('Cheques', array(
'criteria'=>array(
'condition'=>"status='PENDIENTE' and aprobado_ok = '0' and dfecdoc >= '".$fecDsd."' and dfecdoc <= '".$fecHst."'",
'order'=>'dfecdoc',
),
'keyAttribute'=>'idrow',
'pagination'=>array(
'pageSize'=>10,
'pageVar'=>'page'
),
));
$this->renderPartial('dialogFilter',array("model"=>$model),false,true);
}
El dialogFilter
<?php
$this->beginWidget('zii.widgets.jui.CJuiDialog',array(
'id'=>'DialogFilter',
'options'=>array(
'title'=>'Aprobación de cheques',
'autoOpen'=>true,
'modal'=>true,
'width'=>'auto',
'height'=>'auto',
),
));
//$this->renderPartial('_formFilter', array("id"=>$id,"fecDsd"=>$fecDsd,"fecHst"=>$fecHst));
$this->renderPartial('_formFilter',array("model"=>$model),false,true);
$this->endWidget('zii.widgets.jui.CJuiDialog');
?>
En el _formFilter.php
<?php
/* @var $this AprobacionController */
/* @var $model Aprobacion */
?>
<!-- div class="form" -->
<script type="text/javascript">
// This function is called by the "Actualizar" button above
function act_cheques()
{
var selec = $.fn.yiiGridView.getSelection('Cheques-Grid');
$('#oculto').val(selec);//asigno al campo oculto los campos
return false;
};
</script>
<!-- div class="form" -->
<?php
$form=$this->beginWidget('CActiveForm', array(
'id'=>'Aprobacion-form',
'enableAjaxValidation'=>false,
));
echo CHtml::button('Actualizar', array(
'onclick'=>"act_cheques()",
'class'=>"row-button",
'submit' => array('marcacheques')
));
echo '<div class="row" align="center">';
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'Cheques-Grid',
'selectableRows'=>2,
'dataProvider' =>$model,
'columns' => array(
array(
'name'=>'idrow',
'id'=>'ids',
'value'=>'$data->idrow',
'class'=>'CCheckBoxColumn',
),
array(
'name'=>'dfecdoc',
'value'=>'date("d-m-Y",strtotime($data->dfecdoc))'
),
array(
'name'=>'cbeneficiario',
'htmlOptions'=>array('width'=>'400'),
),
array(
'name'=>'cdescrip',
'htmlOptions'=>array('width'=>'400'),
),
array(
'name'=>'nmonto',
'value'=>'Yii::app()->format->formatNumber($data->nmonto)',
'htmlOptions'=>array('style'=>'text-align:right'),
),
'idrow'
),
));
echo CHtml::HiddenField('oculto','');//campo en el que guarda los id
$this->endWidget();
?>
<!-- /div -->
<div id="CloseWindow"></div>