JUI tab di Yii Framework

# Modifikasi ActionView di Controller tersebut

public function actionView($id)
//add other tab;

//pass all tab parameter to the View;

public function newOrtu($id)
$model=new AMahasiswaOrtu;

// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);

$model->parent_id=$id; //Save the subModule Parent ID = Module ID

return $model;


//public function newPendidikan($id)
// …….
//DO the same with another subtab model

#2. Add this into View
widget(‘zii.widgets.jui.CJuiTabs’, array(
‘tabs’ => array(
‘Detail’ =>$this->renderPartial(“_tabDetail”, array(“model”=>$model), true), //Standard View generated by Gii
‘Orang Tua’ =>$this->renderPartial(“_tabOrangTua”, array(“model”=>$model,”modelOrtu”=>$modelOrtu), true),
‘Pendidikan’ =>$this->renderPartial(“_tabPendidikan”, array(“model”=>$model,”modelPendidikan”=>$modelPendidikan), true),
//as much as your tab … add here
‘options’ => array(
‘collapsible’ => true,

#3. create _tabDetail.php on the same folder with view.php and move all detail
widget(‘zii.widgets.CDetailView’, array(
//and so on

#4. create _tabOrangTua.php and create CGridView in it
widget(‘zii.widgets.grid.CGridView’, array(
‘dataProvider’=>AMahasiswaOrtu::model()->search($model->id), //Call DataProvider from SubTab Model. Must Modification the class on that model…
//’filter’=>$model, //must be disabled
//all field

#4a. Remember simple modification on Ortu Model. see this

public function search($id) //Add $id as parameter
// Warning: Please modify the following code to remove attributes that
// should not be searched.

$criteria=new CDbCriteria;

$criteria->compare(‘parent_id’,$id); //filter it here

return new CActiveDataProvider(get_class($this), array(

#5. create the same view for another subTab. Pendidikan, Pengalaman, History, Riwayat, dsb…

Leave a Comment