Bootstrap Dropdown not working with Kartik ExportMenu widget in yii2 - twitter-bootstrap-3

When I use Kartik ExportMenu widget in my code, all dropdown stop working..
Here's a sample of code I am using,
echo ExportMenu::widget([ 'dataProvider' => $dataProvider, 'columns' => $gridColumns ]);
the widget is affecting only that single page, dropdowns on other pages are working..
After some Googling, I found that its conflicting with bootstrap js file.. which I am including in my Asset 'bootstrap.min.js',
if I remove bootstrap.min.js, obviously.. all dropdown should stop working.. but the dropdown on the page I have widget are working..
In my project I need to use both of them...
Is there any solution, anyone can think off??

for that use unset concept in that particular page.
add following lines at the end of your code.
<?php unset($this->assetBundles['yii\bootstrap\BootstrapAsset']); ?>

Add a showColumnSelector to the widget options and assign value true to it. as in:
echo ExportMenu::widget([
'dataProvider' => $dataProvider,
'columns'=>$gridColumn,'showColumnSelector' => \true,
]);

Related

Making a dynamic Form in Prestashop

What I want to achieve Image! Hi I am working on a module in prestashop. What I want is that there should be a button (any-name: Add new field) in the backoffice-(Module Configuration page the first page that comes when you configure your module) that the user presses and it should add a new input field in the form. This all should be done using the helper classes. How can I achieve that? Some code would be grateful! I have uploaded an image. I have tried it using jQuery and it works but I need this done using helperForms in prestashop! In jQuery if I press the add new field button it adds an input field dynamically but the helper-classes are not used in that case.
Here is a link to the documentation :
http://doc.prestashop.com/display/PS16/Using+the+Helper+classes
the documentation is for PS 1.6 but it should also work with PS 1.7
Here is an example of code that generate a form with Helper Classes :
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Edit carrier'),
'image' => '../img/admin/icon_to_display.gif'
),
'input' => array(
array(
'type' => 'text',
'name' => 'shipping_method',
),
),
'submit' => array(
'title' => $this->l('Save'),
'class' => 'btn btn-default pull-right'
)
);
I don’t know if you can use Helper class for custom forms that update custom datas. I’m sure you can use them to update module configuration and prestashop object (customer, etc.)
Helper classes enable you to generate standard HTML elements for the
back office as well as for module configuration pages.

Using Yii2 Bootstrap widgets with Smarty

I've installed Yii2 together with Smarty for my views.
Smarty itself is working, but I can't figure out how to use the bootstrap widgets with smarty, nor find any examples.
With the default Yii renderer the widgets work great, and lots of examples are available. But when using Smarty templates documentation is nearly non existing.
How would I define this example with Smarty ?
echo Alert::widget([
'options' => [
'class' => 'alert-info',
],
'body' => 'Alert widget',
]);
Obviously the first thing would be
{use class="yii\bootstrap\Alert"}
But I can't find an example of how to define the widget itself.
You should simply try this :
{use class='#yii\bootstrap\Alert' type='function'}
{Alert body='Alert widget' options=['class' => 'alert-info']}
Read more : http://www.yiiframework.com/doc-2.0/guide-tutorial-template-engines.html#importing-static-classes-using-widgets-as-functions-and-blocks
After changing config/web.php and adding:
'globals' => ['html' => '\yii\helpers\Html'],
'uses' => ['yii\bootstrap'],
in the view section, it works.
{use class='yii\bootstrap\Alert' type='function'}
{Alert body='Alert' options=['class' => 'alert-info']}
So without the # soju suggested.

enabling layout disables cjuidatepicker yii

I have a small view which renders cjuidatepicker widget.
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'flat'=>FALSE,
// 'model' => $model,
'attribute' => 'start_date',
// 'value' => $model->start_date,
'name'=>'dateSelect',
'options' => array(
'showButtonPanel' => true,
'changeYear' => true,
'dateFormat' => 'yy-mm-dd',
),
));?>
while this renders nicely without using a layout, but when I put this view in my project layout, the datepicker refuses to show up.
I have no ideas where to look for this, all the css and js are loading similarly in layout and without layout.
Any help would be greatly appreciated.
Thanks
Having dealt my fair share with the datepicker, I'm willing to bet money on that the root to your problem is an error in your javascript. Try to comment out all included javascript in your layout and see what happens. For example, maybe you have jQuery included twice, or some code section missing a closing bracket. Basically any js error will throw datepicker off it's game. Just check the js console in your favorite browser.
I had multiple versions of jquery being loaded and that created quite a mess. Yii jquery was different from the template jquery version being used. Brought both of them to an agreement and boom!!

enableAjaxValidation is not working cactiveform in yii

I am using both the client validation and ajax validation for my CActiveForm but both the client and ajax validations are not performing if i remove ajaxvalidation means to false the client validation is happening. can any suggest for the solution here i am posting my code
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'useraccess-form',
'enableClientValidation'=>true,
'enableAjaxValidation'=> true,
'clientOptions' => array(
'validateOnSubmit' => true
),
)); ?>
I got the same problem when tried to set id for feilds via htmlOptions
Check source code of generated page. Compare ids of fields in javascript code with ids in html code
I am included JQuery twice. Need once and with framework.
<?php Yii::app()->getClientScript()->registerCoreScript('jquery'); ?>

yii Tipsy tooltip css does not work while using in ajax popup?

I am using Tipsy tooltip
in a popup which loads on ajax call. In such case the tooltip css does not work. The widget load the css file but does not work.
Here is my code :
<a id="north-west" href="#" original-title="Click on this">Click me</a>
<?php
$this->widget('application.extensions.tipsy.Tipsy', array(
'trigger' => 'hover',
'items' => array(
array('id' => '#north-west', 'gravity' => 'sw'),
),
));
?>
Usually when you load via ajax you would use 'renderPartial' instead of 'render'. There is one catch though: If you have javascript in it you need to make sure the processOutput parameter is set to TRUE. Basically the call would be:
$this->renderPartial('view', array(<data>), FALSE, TRUE);
Yii would then make sure the javascript is also returned, it normally does not do that with a partial. This is only required for ajax calls where the renderPartial is the only output you do, not for calls to it during a regular request.