0
votes

I got a modal like that. Now i want to add Kartik's Popover X to the injected form.

<div class="ensemble-form-add">  

    <?php
    $content = '<p class="text-justify">sometext</p>';
    echo PopoverX::widget([
        'id' => 'ownShit',
        'header' => 'Usage Information',
        'size' => PopoverX::SIZE_LARGE,
        'placement' => PopoverX::ALIGN_BOTTOM,
        'content' => $content,
        'toggleButton' => ['label'=>'<span class="glyphicon glyphicon-question-sign"></span>', 'class'=>'btn btn-lg btn-link'],
    ]); ?>

    <?php $form = ActiveForm::begin(['id' => 'add ...
...

The popover button and dialog (hidden) is rendered correctly. But hitting the button within the modal doesn't do anything. If i open up the above form alone (not in modal) the button works and displays the dialog.

Has anyone tried this before? Do i have to set id's to get this working?

1
Tried another aproach without PopoverX. link . Unfortunately couldn't get this one working either in the modal window. Outside of it, no problem.Luc

1 Answers

0
votes

Finally i got it working. I used the code from this link :

public static function renderLabelHelp($label, $help) {
    return Html::tag('label', $label, [
        'data-toggle'=>'popover',
        'data-trigger' => 'click hover',
        'data-placement' => 'auto right',
        'data-html' => 'true',    // allow html tags
         // 'data-title'=> 'Help',
        'data-content'=>$help,
        'style'=>'border-bottom: 1px dashed #888; cursor:help;'
    ]);
}

And added the following js to make it work like a charm!

$(function(){
    // this will show the popover within a modal window
    $('#modal').on('shown.bs.modal', function(){
        $('[data-toggle="popover"]').popover();
    });
});