Yii Framework Forum: Cjuitabs - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cjuitabs Rate Topic: -----

#1 User is offline   mbala 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 155
  • Joined: 21-July 12
  • Location:Chennai, Tamilnadu, India

Posted 27 September 2012 - 08:06 AM

Format 1:Basic

$this->widget('zii.widgets.jui.CJuiTabs', array(
    'tabs' => array(
        'StaticTab 1' => 'Content for tab 1',
        'StaticTab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'),
        // panel 3 contains the content rendered by a partial view
        'AjaxTab' => array('ajax' => $this->createUrl('...')),
    ),

    // additional javascript options for the tabs plugin
    'options' => array(
        'collapsible' => true,
    ),
));



Format 2:Content Using Render Method

$this->widget('zii.widgets.jui.CJuiTabs', array(
    'tabs' => array(
        'StaticTab 1' => 'Content for tab 1',
        'StaticTab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'),
        // panel 3 contains the content rendered by a partial view
        'AjaxTab' => array('ajax' => $this->createUrl('..')),
[color="#FF0000"]// Get Content From Another page. Also Pass Parameter[/color]
        'Render View'=>$this->renderPartial('_newpage',
                                array('value'=>$value),
                                              TRUE
       )),
    ),

    // additional javascript options for the tabs plugin
    'options' => array(
        'collapsible' => true,
    ),
    // set id for this widgets
    'id'=>'MyTab',
));



Format 3:Content Using Render Method And Set Id For Each Single Tab

$this->widget('zii.widgets.jui.CJuiTabs', array(
    'tabs' => array(
        'StaticTab 1' => 'Content for tab 1',
        'StaticTab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'),
        // panel 3 contains the content rendered by a partial view
        'AjaxTab' => array('ajax' => $this->createUrl('..')),
        'Render View'=>array('id'=>'renderid',
                             'content'=>$this->renderPartial(
                                '_newpage',
                                 array('value'=>$value),TRUE)
                              ),
    ),

    // additional javascript options for the tabs plugin
    'options' => array(
        'collapsible' => true,
    ),
    // set id for this widgets
    'id'=>'MyTab',
));


Dynamic CJuiTabs

$tab_list=Componenttabs::gettabs();
$tabarray=array();
$i=1;
foreach ($tab_list as $key=>$value){  
 $tabarray["Tab $i"]=array('id'=>$i,
                            'content'=>$this->renderPartial(
                                       '_newpage',                                
                                        array('value'=>$value),
                                        TRUE)
     );
 $i++;
}

$this->widget('zii.widgets.jui.CJuiTabs', array(
    'tabs'=>
  $tabarray,
/*array(
        'StaticTab 1'=>'Content for tab 1',
        'StaticTab 2'=>array('content'=>'Content for tab 2', 'id'=>'tab2'),
        // panel 3 contains the content rendered by a partial view
        //'AjaxTab'=>array('ajax'=>$ajaxUrl),
    ),*/

    // additional javascript options for the tabs plugin
    'options'=>array(
        'collapsible'=>true,
    ),
    'id'=>'categorytabs',
));



Hint
When you use more than one CJuiTabs "Dont Forget" to set "ID".
Otherwise you will get some problem
0

#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,047
  • Joined: 16-February 11
  • Location:Japan

Posted 27 September 2012 - 08:12 AM

/* Moved from "General Discussion for Yii 1.1.x" to "Tips, Snippets and Tutorials" */

Thanks mbala for your contribution.
Would you please re-edit the post using "code" tag ("<>" button) to make it more useful?
0

#3 User is offline   mbala 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 155
  • Joined: 21-July 12
  • Location:Chennai, Tamilnadu, India

Posted 27 September 2012 - 08:46 AM

Thanks
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users