kartik-v / yii2-grid

Enhanced GridView with various utilities for Yii Framework 2.0
http://demos.krajee.com/grid
Other
557 stars 302 forks source link

Popover not visible after grid refresh #1020

Closed hykelvinlee42 closed 2 years ago

hykelvinlee42 commented 2 years ago

Prerequisites

Steps to reproduce the issue

  1. Create a grid view with editable columns
    [
        'attribute' => 'some_attribute',
        'class' => 'kartik\grid\EditableColumn',
        'refreshGrid' => true,
        'filter'=>['1' => 'Yes', '0' => 'No'], 
        'filterWidgetOptions'=>[
            'pluginOptions'=>['allowClear'=>true],
        ],
        'editableOptions' => [
            'inputType' => Editable::INPUT_SWITCH,
            'options' => [
                'pluginOptions' => ['onText' => 'Yes', 'offText' => 'No']
            ],   
            'formOptions' => ['action' => ['some_action/edit]],
            'pjaxContainerId' => 'permission',
            'format' => 'button',
            'asPopover' => true,
            'displayValueConfig' => [
                '1' => '<span class="label label-success">Yes</span>',
                '0' => '<span class="label label-danger">No</span>',
            ],
        ],
    ],
  2. Update attribute value in the popover dialog
  3. Click on the any edit buttons after the grid refreshes

Expected behavior and actual behavior

When I follow those steps, I see no popover dialog is displayed on click after the refresh.

I was expecting the popover editing dialog will continue to be displayed and function on click.

If I set asPopover to false, the editing dialog is displayed in the grid cell and functions normally even after the grid refreshes.

Environment

Browsers

Operating System

Libraries

Isolating the problem

hykelvinlee42 commented 2 years ago

Resolved by reinitializing popoverButton.
Reference: https://github.com/kartik-v/yii2-popover-x/issues/8