kartik-v / yii2-grid

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

Gridview with pjax enabled- editable column with Touch Spin widget doesn't initialize properly (js error insteed) #977

Closed fastp-dev closed 3 years ago

fastp-dev commented 3 years ago

Prerequisites

Steps to reproduce the issue

  1. Use Kartik enchanced Gridview with pjax enabled
  2. Add editable colum with INPUT_SPIN input type
  3. Reload grid by using pjax by sorting, using pagination etc.

View (index.php)

echo GridView::widget([ 'id' => 'warehouse-table', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'pjaxSettings' => [ 'neverTimeout' => true, 'refreshGrid' => true, ], //'headerRowOptions' => ['class' => 'kartik-sheet-style'],

    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],

        [
            'class' => 'kartik\grid\EditableColumn',
            'attribute' => 'diameter',
            'editableOptions' => [
                'inputType' => \kartik\editable\Editable::INPUT_SPIN,
                'options' => [
                    'pluginOptions' => [
                        'min' => 0,
                        'step' => 0.1,
                        'decimals' => 2,
                        'buttonup_class' => 'btn btn-primary',
                        'buttondown_class' => 'btn btn-info',
                        'buttonup_txt' => '<i class="glyphicon glyphicon-plus-sign"></i>',
                        'buttondown_txt' => '<i class="glyphicon glyphicon-minus-sign"></i>'
                    ]
                ],
                'formOptions' => ['action' => ['/warehouse/warehouse-tools/editstock']]
            ],
            'hAlign' => 'right',
            'vAlign' => 'middle',
            'width' => '7%',
            'format' => ['decimal', 2],
        ],

        'last_updated_datetime:datetime',

        [
            'class' => 'yii\grid\ActionColumn',
            'template' => '{delete}',
            'buttons' => [
                'delete' => function ($url, $model) {
                    return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['warehouse/warehouse-tools/delete', 'id' => $model->id], [
                        'title' => 'Usuń', 'class' => 'warehouse-delete',
                        'data-pjax' => 0
                    ]);
                },
            ],
        ],

    ],
]);

Controller public function actionIndex() { $searchModel = new WarehouseToolsSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

    return $this->render('index', [
        'searchModel' => $searchModel,
        'dataProvider' => $dataProvider,
    ]);
}

Expected behavior and actual behavior

When I follow those steps, I can't use editable column with x-popup and touch spin widget. Only 1st record is editable, rest is broken. I got JS error: Uncaught TypeError: $el[0] is undefined getPosition http://localhost/basic/web/assets/621235e8/js/bootstrap-popover-x.js:234 Screens

I was expecting normal widget work. I created fresh installation of Yii2, installed latest version of all widgets. When spin widget is removed others widgets works fine eg. INPUT_DROPDOWN_LIST ss2

Environment

Browsers

Operating System

Libraries

Isolating the problem

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.