TabView

if you want to use same view in all tabs with different parameters.

i.e. if you want to send different viewDatas to same view instead of sending same viewData to different views(or same view).

you can extent CTabView class overriding its renderBody method like this:


Class TabView extends CTabView

{

 

	public function renderBody()

	{

		foreach($this->tabs as $id=>$tab)

                {

                        $inactive=$id!==$this->activeTab?' style="display:none"' : '';

                        echo "<div class=\"view\" id=\"{$id}\"{$inactive}>\n";

                        if(isset($tab['content']))

                                echo $tab['content'];

                        else if(isset($tab['view']))

                                $this->getController()->renderPartial($tab['view'], $tab['viewData']);

                        echo "</div><!-- {$id} -->\n";

                }


	}


}

actually you are just replacing this line:


$this->getController()->renderPartial($tab['view'],$this->viewData);

with this:


$this->getController()->renderPartial($tab['view'], $tab['viewData']);

then you can use following:


$tabs= array(

            'tab1'=>array('title'=>'Tab 1 Title', 'view'=>'/some/view', 'viewData'=>array('param1'=>$param1)),

            'tab2'=>array('title'=>'Tab 2 Title', 'view'=>'/some/view', 'viewData'=>array('param2'=>$param2)),

             );

$this->widget('TabView', array('tabs' => $tabs));