Cjuitabs Not Working In Renderpartial

Hi mates!

Next view, works with render() but not with renderPartial(), what is the explanation?

The trouble, might be caused by CJuiTabs, considering that CDetailView works accurately in both case.;)

The render action views is the same for both, and the difference is that:

  • renderPartial, is calling from an ajax request.

View file: _view_day.php




<?php 

$this->widget('zii.widgets.CDetailView', array(

	'data' => $modelDay,

	'attributes' => array(

'id_day',

array(

	'name' => 'name',

	'type' => 'text',

	'value' => $modelDay->nameLanguage($code),

),

	),

)); 

?>

<?php 

$count = 1;

$tabs = array();

foreach($modelDay->timetables as $timetable)

{

    	$tabs['Itinerario'.$count] =  $this->renderPartial('tabs/_view_timetable',  array('model'=>$timetable,'code'=>$code),true);

    	$count++;

}

$this->widget('zii.widgets.jui.CJuiTabs', array(

        	'id' => 'day-tabs',

        	'tabs'=>$tabs,

        	'options'=>array(

            	'collapsible'=>true,

            	'selected'=>0,

        	),

        	'htmlOptions'=>array(

            	'style'=>'width:500px; '

        	),

));

?>



action: _view_day.php


 public function actionViewDay ($id,$code=130, $serie=1) {

            	

            	$idRoute = (int) $id;

            	$codeLanguage = (int) $code;

            	$aux_serie = (int) $serie;


            	$model = ($this->loadModel($idRoute, 'Route')); 

            	$modelDay = ($this->loadModel($model->getId_Day($aux_serie, $codeLanguage), 'Day'));

            	

            	$this->render('view_day', array( 			

                    	'model' => $model,

                    	'code' => $codeLanguage,

                    	'modelDay' => $modelDay,

            	));

	}

To be more clear,

See below CJuiTabs appearence with renderPartial(), as a not ordered list <ul><li> but without class that gets it the accurate aspect - like see in second image -

[size="2"]Image 1. CJuiTabs with renderPartial()[/size]

…and this other with render:

[size="2"]Image 2. CJuiTabs with render()[/size]

For some reason that I can’t explain,

When uses Jui collection, Yii framework assigns the "css classes" for one case but not another.

Yii NOT assign JUI class


<div id="yw1">

  <h3>

 	<a href="#"> Details </a>

  </h3>

<div>

Yii assign JUI class


<div id="yw1" class="ui-accordion ui-widget ui-helper-reset" role="tablist">

  <h3 id="ui-accordion-yw1-header-0" class="ui-accordion-header ui-helper-reset ui-state-default ui-accordion-header-active ui-state-active ui-corner-top ui-accordion-icons" role="tab" aria-controls="ui-accordion-yw1-panel-0" aria-selected="true" tabindex="0">

 	<span class="ui-accordion-header-icon ui-icon ui-icon-triangle-1-s"></span>

 	<a href="#"> Details </a>

  </h3>

[size=“3”]When and how is assigning JUI’s classes? [/size]

You might need to look into the 3rd/4th parameters in renderPartial() and there is something about NOT resending the jquery through clientScript->scriptMap(), or something like that.

Exact!

The trouble came from 3rd/4th parameters ($return and &processOutput, both “false” 's by default).

And combinated is how I get what expect it.

  • $return: is used when you need to delay the rendering view ("true" for this)
  • $processOutput: moment wants the rendering ("true" for this)

How I don’t explained quite well, to more details go to Yii documentation renderPartial().

Also you can go to this StackOverflow explanation Yii RenderPartial Parameters from Alexander Kuzmin.

A thousand thanks jkofsky!