dmstr / yii2-adminlte-asset

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

treeview menu-open by default #167

Closed deshario closed 6 years ago

deshario commented 6 years ago

How to open treeview menu-open by default ... like in the image below .. is there way to do it in yii2..

dropdown

 $menuItems = [
                  [
                        'label' => 'Tools',
                        'icon' => 'cog',
                        'url' => '#',
                        'items' => [
                            ['label' => 'Verifications', 'icon' => 'qrcode', 'url' => ['donation-verified/index'],],
                            ['label' => 'Profile', 'icon' => 'user-o', 'url' => ['user/profile'] ],
                            ['label' => 'Decryption', 'icon' => 'user-o', 'url' => ['user/hashing'] ],
                            ['label' => 'Logout', 'url' => ['site/logout'], 'template' => '<a href="{url}" data-method="post"><i class="fa fa-sign-out"></i>{label}</a>'],
                        ],
                    ]
            ];

echo dmstr\widgets\Menu::widget([ 'options' => ['class' => 'sidebar-menu tree', 'data-widget'=> 'tree'], 'items' => $menuItems ]);

schmunk42 commented 6 years ago

You need to set the active key of an item.

See also https://github.com/dmstr/yii2-adminlte-asset/blob/master/widgets/Menu.php

deshario commented 6 years ago

I set to 'active' => '#' ... its working but i want to know that what should be the value of 'active' => ''

[ 'label' => 'Tools', 'active' => '#', 'icon' => 'cog', 'url' => '#', 'items' => [ ['label' => 'Verifications', 'icon' => 'qrcode', 'url' => ['donation-verified/index'],], ['label' => 'Profile', 'icon' => 'user-o', 'url' => ['user/profile'] ], ['label' => 'Decryption', 'icon' => 'user-o', 'url' => ['user/hashing'] ], ['label' => 'Logout', 'url' => ['site/logout'], 'template' => '{label}'], ], ]

schmunk42 commented 6 years ago
[
  'active' => true, 
  'label' => 'Verifications', 
  'icon' => 'qrcode', 
  'url' => ['donation-verified/index'],
],