Yii Framework Forum: Tabs Yii - Yii Framework Forum

Jump to content

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

Tabs Yii ??? Rate Topic: ***** 1 Votes

#1 User is offline   erickMartinez 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 160
  • Joined: 20-December 13

Posted 30 April 2014 - 02:59 PM

Hola comunidad yii :D

este es mi código

<?php $this->widget('bootstrap.widgets.TbTabs', array(
        'id' => 'mytabs',
        'type' => 'tabs',
        'tabs' => array(
            
                array('id' => 'tab1', 'label' => 'Registrar Vehiculo', 'content' => 'loading ....'),
                array('id' => 'tab2', 'label' => 'Registrar Personas', 'content' => 'loading ....'),
                array('id' => 'tab3', 'label' => 'Estado legal Vehiculos', 'content' => 'loading ....'),
                array('id' => 'tab4', 'label' => 'Estado legal Personas', 'content' => 'loading ....'),
               


        ),
        'events'=>array('shown'=>'js:loadContent')
    )
);?>



<script type="text/javascript">

function loadContent(e){

    var tabId = e.target.getAttribute("href");

    var ctUrl = '';

    if(tabId == '#tab1') {
        ctUrl = '<?php echo $this->createUrl('getvehrs/index')?>';


//eg: ctUrl = '<?php echo $this->createUrl('emailQueues/test/id/'.$id)?>';

    } 

    if(tabId == '#tab2') {
        ctUrl = '<?php echo $this->createUrl('getperrs/index')?>';
    }
    if(tabId == '#tab3') {
        ctUrl = '<?php echo $this->createUrl('geteslvs/index')?>';
    }
    else if(tabId == '#tab4') {
        ctUrl = '<?php echo $this->createUrl('geteslps/index')?>';
    }

    if(ctUrl != '') {

        $.ajax({

  
            url      : ctUrl,
            type     : 'POST',
            dataType : 'html',
            cache    : false,
            success  : function(html)
            {
                jQuery(tabId).html(html);
            },
            error:function(){
                    alert('Request failed');
            }
        });
    }

    preventDefault();
    return false;
}

</script>



lo que sucede es que cuando cambio de tab el menú principal(layout/main) se me bloquea y no deja desplegar las opciones ..... alguien podría explicarme que sucede y como lo puedo solucionar ? por favor :D
0

#2 User is offline   erickMartinez 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 160
  • Joined: 20-December 13

Posted 05 May 2014 - 10:11 AM

solucionado se arreglo al poner este código en /components/controller :blink: :blink:

function init(){//crear esto se no existir 
parent::init(); 
if(Yii::app()->getRequest()->isAjaxRequest){ //if the page was loaded by ajax (ajaxTab) 
$this->layout=false;//disable the layout 
} 

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