Yii Framework Forum: Erro widget jui YII2 - Yii Framework Forum

Jump to content

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

Erro widget jui YII2 Rate Topic: -----

#1 User is offline   Paulo Henrique 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 07-November 15

  Posted 14 April 2016 - 03:43 PM

Estou tentando incluir uma Tab em meu View:

use yii\jui\Widget;
use yii\jui\Tabs;

...

    <?= $this->widget('zii.widgets.jui.CJuiTabs',array(
        'tabs'=>array(
            'StaticTab 1'=>'Content for tab 1',
            'StaticTab 2'=>'<div class="row">Teste 2</div>',
        ),
        // additional javascript options for the tabs plugin
        'options'=>array(
            'collapsible'=>true,
        ),
    ));
    ?>


Retorna o seguinte erro:

Calling unknown method: yii\web\View::widget()
0

#2 User is offline   Luan Nascinento 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 31
  • Joined: 10-November 14

Posted 15 April 2016 - 11:25 AM

eaw blz...

Paulo Henrique, no Yii2 eu uso assim:

use yii\helpers\Html;
use yii\bootstrap\tabs;

<?php
		echo Tabs::widget([
			'items' => [
				[
					'label' => 'Label 1',
					'content' => $this->render('view1',[
						'data' => $site,
					]),
					'active' => true
				],
				[
					'label' => 'Label 2',
					'content' => $this->render('view2',[
						'data' => $contato,
					]),
				],
			],
		]);
	?>

0

#3 User is offline   Paulo Henrique 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 07-November 15

Posted 15 April 2016 - 06:31 PM

View PostLuan Nascinento, on 15 April 2016 - 11:25 AM, said:

eaw blz...

Paulo Henrique, no Yii2 eu uso assim:

use yii\helpers\Html;
use yii\bootstrap\tabs;

<?php
		echo Tabs::widget([
			'items' => [
				[
					'label' => 'Label 1',
					'content' => $this->render('view1',[
						'data' => $site,
					]),
					'active' => true
				],
				[
					'label' => 'Label 2',
					'content' => $this->render('view2',[
						'data' => $contato,
					]),
				],
			],
		]);
	?>




Desculpe a minha ignorância, esse código devo colocar na Controller, form ou view?
0

#4 User is offline   Luan Nascinento 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 31
  • Joined: 10-November 14

Posted 16 April 2016 - 08:02 AM

View PostPaulo Henrique, on 15 April 2016 - 06:31 PM, said:

Desculpe a minha ignorância, esse código devo colocar na Controller, form ou view?


Vai colocar na View,

'label' => 'TITULO',
'content' => $this->render('VIEW_QUE_VAI_CHAMAR',['data' => $site,]),

no content você escreve os dados ou chama outra viewe a variável $site vem do controle.
0

#5 User is offline   Paulo Henrique 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 07-November 15

Posted 18 April 2016 - 07:43 AM

View PostPaulo Henrique, on 15 April 2016 - 06:31 PM, said:

Desculpe a minha ignorância, esse código devo colocar na Controller, form ou view?



Funcionou só que está aparecendo como Lista e não como Abas.

Aparece assim:

  • Label 1
  • Label 2


Acredito que falta algo para ele puxar o CSS do Bootstrap.

Queria ele assim:

Label 1 | Label 2
0

#6 User is offline   Luan Nascinento 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 31
  • Joined: 10-November 14

Posted 19 April 2016 - 07:57 AM

Veja se carrega os CSS do Bootstrap
0

#7 User is offline   Luan Nascinento 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 31
  • Joined: 10-November 14

Posted 19 April 2016 - 07:59 AM

Veja se carrega os CSS do Bootstrap
0

#8 User is offline   Paulo Henrique 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 07-November 15

Posted 22 April 2016 - 10:41 AM

View PostLuan Nascinento, on 19 April 2016 - 07:59 AM, said:

Veja se carrega os CSS do Bootstrap



carrega: <link href="/easymobile/web/assets/9d40930f/css/bootstrap.css" rel="stylesheet">
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