navbar - SideNav opening the page in the same window (Yii2) -


i trying use sidenav url open page in same window not redirecting different place. how can ? when click link in sidenav page should open in same window.

<?= sidenav::widget([             'type' => sidenav::type_default,             'heading' => 'dashboard',             'items' => [                 [                     'url' => '#',                     'label' => 'purchase',                     'icon' => 'home',                      'items' => [                          ['label' => 'suppliers', 'icon'=>'glyphicon transport', 'url'=>'../site/about'],                          ['label' => 'leaf entry', 'icon'=>'leaf', 'url'=>'#'],                          ['label' => 'payments', 'icon'=>'phone', 'url'=>'#'],                          ['label' => 'reports', 'icon'=>'phone', 'url'=>'#']                         ],                 ], 

above code page open different window. need open in same window. how can friends ?

enter image description here

in link items add class example ajaxload , add following js code:

$(document).on('click', '.ajaxload', function(e){         e.preventdefault();         $('#main-content').load($(this).attr('href'));         return false; }); 

lets assume want page content rendered inside container div has id of main-content

the idea is, js script listen click events , when click on link has ajaxload class, grab href value of , load pages content inside main-content div.

note in controller action have use renderajax instead of render.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -