Open tomekbyd opened 5 years ago
The problem is with the function:
protected function getColumnID()
{
if (empty($this->_columnID)) {
$this->_columnID = md5(VarDumper::dumpAsString(get_object_vars($this), 5));
}
return $this->_columnID;
}
After update data in GridView by Pjax, _columnID changes. When I try to enter _columnID permanently, everything will work correctly after changing filter, sorting and subpage.
Hi. Most likely the problem is in this line: https://github.com/dimmitri/yii2-expand-row-column/blob/master/ExpandRowColumn.php#L191
Probably need a setting to allow loading of scripts after ajax.
I commented this condition, but began to work as something very strange. On clicking the link (in ExpandRowColumn) it opens and then immediately closes. There are no ideas how to fix them yet. Pull request is always welcome.
The problem is with the function:
protected function getColumnID() { if (empty($this->_columnID)) { $this->_columnID = md5(VarDumper::dumpAsString(get_object_vars($this), 5)); } return $this->_columnID; }
After update data in GridView by Pjax, _columnID changes. When I try to enter _columnID permanently, everything will work correctly after changing filter, sorting and subpage.
v1.0.5 - Will this edit solve the problem?
The fix unfortunately does not work. For the first load, I have the same ID in data-col_id and "jQuery (document) .on ('click', '# w1 .expand-row-column -...... After loading data by AJAX data-col_id changes , the jQuery code is still looking for the old ID.
Did you use the 'column_id' parameter?
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
[
'class' => ExpandRowColumn::class,
'attribute' => 'name',
'url' => Url::to(['info']),
'column_id' => 'my_row_id',
],
],
]) ?>
When added, column_id works fine. I have one more problem with yii\grid\CheckboxColumn. I add the visible parameter in the CheckboxColumn. When visibility change, in ExpandRowColumn colspan does not change.
I have one more problem with yii\grid\CheckboxColumn. I add the visible parameter in the CheckboxColumn. When visibility change, in ExpandRowColumn colspan does not change.
Is it possible to give an example of the code with the problem?
I have removed what is irrelevant.
<?php Pjax::begin(['id'=>'xxxx']); ?> .................... <?= GridView::widget([ 'id'=>'grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, ..... 'columns' => [ ['class' => 'yii\grid\SerialColumn'], [ 'class' => 'yii\grid\CheckboxColumn', 'visible'=>(!empty($searchModel->xxxx) && Yii::$app->user->identity->xxx!='W') ], [ 'attribute'=>'xxx', 'contentOptions'=>[xxxxxx], ], [ 'class' => ExpandRowColumn::class, 'attribute'=>'xxxxx', 'value'=>'xxxxx', 'url' => Url::to(['info']), 'column_id' => 'expand_row', ], ['class' => 'yii\grid\ActionColumn'], ] ]); ?>
I have one more problem with yii\grid\CheckboxColumn. I add the visible parameter in the CheckboxColumn. When visibility change, in ExpandRowColumn colspan does not change.
I added CheckboxColumn to the example from README. I don't understand what kind of behavior you're expecting. It seems to be nothing unusual.
The problem is when the CheckboxColumn has a visible parameter. After reloading the page by Ajax, if CheckboxColumn visibility changes, colspan does not change and I have one column too low in ExpandRowColumn colspan.
After the page loads, everything works fine. When I select a filter in the main GridView, the expand row will no longer work. I need to reload the page with new filters, that the expand row links will start working again.