css - yii2 nav widget submenu class -


i using adminlte theme bootstrap , uses treeview-menu class in order operate submenu.

<?=nav::widget([             'options' => ['class' => 'sidebar-menu treeview'],             'items' => [                  ['label' => 'menu 1', 'url' => ['/a/index']],                 ['label' => 'menu 2', 'url' => ['/custom-perks/index']],                 ['label' => 'submenu',  'items' => [                     ['label' => 'action', 'url' => '#'],                     ['label' => 'another action', 'url' => '#'],                     ['label' => 'something else here', 'url' => '#'],                     ],                 ],             ],         ]);         ?> 

i tried using: ['label' => 'submenu', 'options' => ['class' => 'treeview-menu'], 'items' =>..

which not work.

i noticed menu::widget has submenutemplate when used stopped pickup "active".

is there way can change either way adminlte call being applied treeview-menu (tried changing in app.js dropdown-menu didn't help) or re-assign ul submenu class without going vendor code?

line 65: \yii\bootstrap\dropdown - function init()

ok have found work around - use menu widget instead , enable activateparents flag:

<?=menu::widget([ 'options' => ['class' => 'sidebar-menu treeview'], 'items' => [      ['label' => 'menu 1', 'url' => ['/a/index']],     ['label' => 'menu 2', 'url' => ['/link2/index']],     ['label' => 'submenu',           'url' => ['#'],         'template' => '<a href="{url}" >{label}<i class="fa fa-angle-left pull-right"></i></a>',         'items' => [             ['label' => 'action', 'url' => '#'],             ['label' => 'another action', 'url' => '#'],             ['label' => 'something else here', 'url' => '#'],         ],     ], ], 'submenutemplate' => "\n<ul class='treeview-menu'>\n{items}\n</ul>\n", 'encodelabels' => false, //allows use html in labels 'activateparents' => true,   ]);  ?> 

hopefully helps others well!


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -