dmstr / yii2-adminlte-asset

AdminLTE Asset Bundle for Backend Theme in Yii2 Framework
1.14k stars 425 forks source link

Multilevel not working #196

Closed Shokhrukh2606 closed 4 years ago

Shokhrukh2606 commented 4 years ago

I have installed your plugin but multilevel list not opening can you help, please?

schmunk42 commented 4 years ago

Please provide an example showing the error.

Shokhrukh2606 commented 4 years ago

It shows any errors on console, but not opening image image And array passed to menu widget:


    [
        'label' => 'Same tools',
        'icon' => 'fa fa-share',
        'url' => '#',
        'options'=>['class'=>'treeview'],
        'items' => [
            [
                'label' => 'Level One',
                'icon' => 'fa fa-circle-o',
                'url' => '#',
            ],
            [
                'label' => 'Level One',
                'icon' => 'fa fa-circle-o',
                'url' => '#',
            ],
        ],
    ] 
schmunk42 commented 4 years ago

Which version do you use?

Did you try the example views? https://github.com/dmstr/yii2-adminlte-asset/blob/master/example-views/yiisoft/yii2-app/layouts/left.php#L12

Shokhrukh2606 commented 4 years ago

I am using version ~2.3.0, I also tried example that you gave but didn't work

Shokhrukh2606 commented 4 years ago

I tried to use as example in pages it worked properly

<ul class="sidebar-menu" data-widget="tree">
            <li class="header">MAIN NAVIGATION</li>
            <?php foreach ($menu as $item) {
                if (isset($item['items'])) { ?>
                    <li class="treeview">
                        <a href="#">
                            <i class="<?=$item['icon']?>"></i> <span><?= $item['label'] ?></span>
                            <span class="pull-right-container">
                                <i class="fa fa-angle-left pull-right"></i>
                            </span>
                        </a>
                        <ul class="treeview-menu">
                            <?php foreach ($item['items'] as $child) { ?>
                                <li><a href="<?=Url::to($child['url'])?>"><i class="<?=$child['icon']?>"></i> <?=$child['label']?></a></li>
                            <?php } ?>
                        </ul>
                    </li>
            <?php } else {
                    $icon=HTML::tag('i','',['class'=>(isset($item['icon'])) ? $item['icon'] : '']);
                    echo  Html::tag('li', Html::a($icon.$item['label'], (isset($item['url'])) ? $item['url'] : ''));
                    // echo Html::tag('li', Html::a($item['label'], (isset($item['url']))?$item['url']:'' ), (isset($item['options']))?$item['options']:'');
                }
            } ?>

        </ul>

but it is a bit hard-coded. Is it correct, if correct you can close this issue))