W
W
walder2018-08-07 09:22:55
Yii
walder, 2018-08-07 09:22:55

Is it possible to make TabsX Kartik tabs inactive?

Hello everyone,
I'm new and just trying to figure out YII2, I have a question. I have three tabs in each of them is a DetailView, is it possible to make it so that if there is no data in one of the DetailViews, then the tab gets another css class?

echo TabsX::widget([
    'position' => TabsX::POS_ABOVE,
    'align' => TabsX::ALIGN_LEFT,
    'items' => [
        [
            'label' => '<i class="glyphicon glyphicon-list"></i> Вкладка 1',
            'content' => DetailView::widget([
                'id'=>'info1',
                'model' => $model,
                'panel' => [
                    'heading' => '<h3 class="panel-title">'.$model->Name.'</h3>',
                    'type'=>DetailView::TYPE_SUCCESS,
                ],
                'attributes' => $info_one,
            ]),
            'encode'=>false,
            'active' => true
        ],
        [
            'label' => '<i class="glyphicon glyphicon-ok"></i> Вкладка  2',
            'content' => DetailView::widget([
                'id'=>'info1',
                'model' => $model,
                'panel' => [
                    'heading' => '<h3 class="panel-title">'.$model->Name.'</h3>',
                    'type'=>DetailView::TYPE_SUCCESS,
                ],
                'attributes' => $info_two,
            ]),
            'encode'=>false,
        ],
        [
            'label' => '<i class="glyphicon glyphicon-briefcase"></i> Вкладка 3',
            'content' => DetailView::widget([
                'id'=>'info1',
                'model' => $model,
                'panel' => [
                    'heading' => '<h3 class="panel-title">'.$model->Name.'</h3>',
                    'type'=>DetailView::TYPE_SUCCESS,
                ],
                'attributes' => $info_three,
            ]),
            'encode'=>false,
        ],
    ]
]);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Edward, 2018-08-08
@walder

[
            'label' => '<i class="glyphicon glyphicon-briefcase"></i> Вкладка 3',
            'content' => DetailView::widget([
                'id'=>'info1',
                'model' => $model,
                'panel' => [
                    'heading' => '<h3 class="panel-title">'.$model->Name.'</h3>',
                    'type'=>DetailView::TYPE_SUCCESS,
                ],
                'attributes' => $info_three,
            ]),
            'encode'=>false,
            'headerOptions' => ['class'=> $value ? '' : 'disabled']
        ],

Where instead of $value , your variable can be empty ( $model or maybe $info_three )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question