Hi all,
i’ve this problem: i’ve created a CJuiTabs in an action view, composed of three partial rendered views (as shown in the code below)
<div>
<?php
$this->widget(‘zii.widgets.jui.CJuiTabs’, array(
'tabs' => array(
'Generale'=>$this->renderPartial('_classifica_punti',array('classificaPointsDp' => $classificaPointsDp),true),
'Per Estensione'=>$this->renderPartial('_classifica_planets',array('classificaPointsDp' => $classificaPlanetsDp),true),
'Per Ricerca'=>$this->renderPartial('_classifica_tech',array('classificaPointsDp' => $classificaTechDp,'model'=>$model),true),
)));
?>
</div>
I tried to implement in the third, an advanced search form in this way (we’re looking the _classifica_tech view)
<?php
Yii::app()->clientScript->registerScript(‘search’, "
$(’.search-button’).click(function(){
$('.search-form').toggle();
return false;
});
$(’.search-form form’).submit(function(){
$.fn.yiiListView.update('classifica_tech', {
data: $(this).serialize()
});
return false;
});
");
echo CHtml::link(ucwords(‘advanced’),’#’,array(‘class’=>‘search-button’)); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial(’_search’,array(
'model'=>$model,
'route'=>'/site/classifica/showMy/position'
)); ?>
</div>
<div id="CtechId">
<?php
$this->widget('zii.widgets.CListView', array(
'id'=>'classifica_tech',
'dataProvider'=>$classificaPointsDp,
'itemView'=>'_classifica_view',
'ajaxUpdate'=>'CtechId'
)); ?>
</div>
and finally this is the code for the _search form…
<div class="wide form">
<?php $form=$this->beginWidget(‘CActiveForm’, array(
'action'=>Yii::app()->createUrl($route),
'method'=>'post',
)); ?>
<table>
<tr>
<td>
<?php echo $form->label($model,'username',array('style'=>'font-size: 10px;font-weight: bold;')); ?>
</td>
<td>
<?php echo $form->textField($model,'username',array('size'=>20,'maxlength'=>20,'style'=>'font-size: 10px;')); ?>
</td>
<td>
<?php echo $form->label($model,'empire',array('style'=>'font-size: 10px;font-weight: bold;')); ?>
</td>
<td>
<?php echo $form->textField($model,'empire',array('size'=>20,'maxlength'=>20,'style'=>'font-size: 10px;')); ?>
</td>
<td>
<?php echo CHtml::submitButton('Search'); ?>
</td>
</tr>
</table>
<?php $this->endWidget(); ?>
</div>
ok i know that probably there is a very simpler way to do it…and surely this way will work, but i really can’t figure it out.
The only thing I know is that this solution doesn’t work: the form is shown as aspected but once the form is submitted it points to the site/classifica/showMy action which code is here…
class ClassificaAction extends CAction{
public function run(){
$model = new User();
$classificaPointsDp = null;
$classificaPlanetsDp= null;
$classificaTechDp = null;
if (!empty ($_GET['showMy'])){
$classificaPointsDp = $model->GetClassificaPoints();
$classificaPlanetsDp = $model->GetClassificaPlanets();
$classificaTechDp = $model->GetClassificaTech();
if(isset($_POST['User']))
$model->attributes=$_POST['User'];
$this->controller->render(
'classifica',
array(
'classificaPointsDp'=>$classificaPointsDp,
'classificaPlanetsDp'=>$classificaPlanetsDp,
'classificaTechDp'=>$classificaTechDp,
'model'=>$model
)
);
}else
$this->redirect(Yii::app()->user->returnUrl);
}
and I can’t understand why the listview in the third tab doesn’t update the items according to the search conditions.
I don’t know (in addition) how can I set the focus of the tab! argh! Please help if you can