Maulana Yusuf
Maulana Yusuf

Reputation: 337

Kartik Gridview conflict with my templates menu

I have a template that i was using for my project.

Look at the picture below:

enter image description here This is when i am not using the kartikGrid. the dropdown menu running as well as the template want.

look at the image below: enter image description here

this is when i use kartik, the dropdown menu not running anymore. can some body tell me why it happen.

The template using different bootsrap version with kartik.

thaks. Hope some body help me.

Upvotes: 1

Views: 531

Answers (3)

Saeed
Saeed

Reputation: 572

Add this code in layout or page that has problem:

$this->registerJs( "$(document).ready(function() { $('.dropdown-toggle').dropdown(); });", View::POS_END, 'ecommerceProductJs' );

Upvotes: 0

Marc-Antoine
Marc-Antoine

Reputation: 109

Imaginaroom, that did the trick for me thank you.

My top menu wasn't responding (direct link, or drop down menu) after kartik was used. I added an id to my menu widget and it did the trick.

echo Nav::widget([
    'id' => 'topMenuID',
    'options' => ['class' => 'navbar-nav navbar-right'],
    'items' => $menuItems,
]);

Upvotes: 4

AwesomeGuy
AwesomeGuy

Reputation: 1089

Manually assign different ids to all widgets, so there won't be any conflicts. If you don't assign ids to widgets, yii gives them one automatically, but the problem occures when loading data with ajax or pjax, then Yii cannot know which ids are already used in the page.

Every widget in Yii2 has a property 'id' that you can assign in configuration array when calling a widget.

Upvotes: 0

Related Questions