Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neither the update button nor the view button works in the detailview #189

Open
1 of 7 tasks
mai-67 opened this issue Aug 23, 2022 · 0 comments
Open
1 of 7 tasks

Comments

@mai-67
Copy link

mai-67 commented Aug 23, 2022

Steps to reproduce the issue

File composer.json:

"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "~2.0.6",
"yiisoft/yii2-bootstrap": "~2.0.0",
"yiisoft/yii2-bootstrap4": "2.0.10",
"yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0",
"yii2tech/spreadsheet": "^1.0",
"phpmailer/phpmailer": "^6.0",
"spipu/html2pdf": "^5.2",
"miloschuman/yii2-highcharts-widget": "v9.0",
"kartik-v/yii2-widget-datepicker": "v1.4.8",
"kartik-v/yii2-field-range": "v1.3.5",
"kartik-v/yii2-widget-depdrop": "v1.0.6",
"kartik-v/yii2-grid": "v3.5.0",
"kartik-v/yii2-widget-select2": "v2.2.3",
"kartik-v/yii2-detail-view": "v1.8.7"
},

File index.php (contains the grid)

'kartik\grid\SerialColumn', 'contentOptions'=>['class'=>'kartik-sheet-style'], 'width'=>'36px', 'pageSummary'=>'Total', 'pageSummaryOptions' => ['colspan' => 6], //'header'=>'', 'headerOptions'=>['class'=>'kartik-sheet-style'], ], [ 'class' => 'kartik\grid\ExpandRowColumn', 'width' => '50px', 'value' => function ($model, $key, $index, $column) { return GridView::ROW_COLLAPSED; }, // uncomment below and comment detail if you need to render via ajax //'detailUrl' => Url::to(['/sec-pa-plan/plan-details','APP_COMPONENTE' => $model->APP_COMPONENTE,'APP_GERENCIA' => $model->APP_GERENCIA, 'PA_ID_VUL' => $model->PA_ID_VUL]), 'detail' => function ($model, $key, $index, $column) { return Yii::$app->controller->renderPartial('plan-details', ['model' => $model]); }, 'headerOptions' => ['class' => 'kartik-sheet-style'], 'expandOneOnly' => true, ], ............................... 'list_planes']) ?>
    <?php //if (! empty($dataProvider)) { ?>
        <?php
         echo GridView::widget([
            'id' => 'kv-grid-plan',
            'dataProvider' => $dataProvider,
            'filterModel' => $searchModel,
            'columns' => $gridColumns, // check the configuration for grid columns by clicking button above
            'containerOptions' => ['style' => 'overflow: auto'], // only set when $responsive = false
            'headerRowOptions' => ['class' => 'kartik-sheet-style'],
            'filterRowOptions' => ['class' => 'kartik-sheet-style'],
            'pjax' => true, // pjax is set to always true for this demo
            'pjaxSettings'=>[
                //'neverTimeout'=>true,
                //'options'=>['id'=>'pjax_id'],
                'options'=>['id'=>'pjax_planes'],
                //'beforeGrid'=>'My fancy content before',
                //'afterGrid'=>'My fancy content after.',
            ],
            'rowOptions'=>function($model){
                    if($model->CRI_ID_PES10 == 'BLOQUEANTE'){
                        return ['style' => 'background-color: #EC7063']; 
                        //return ['class' => GridView::TYPE_DANGER];
                    }else if ($model->CRI_ID_PES10 == 'GRAVE'){
                        //return ['class' => GridView::TYPE_SUCCESS];
                        return ['style' => 'background-color: #EDBB99']; 
                       //return ['style' => 'background-color: orange']; 
                    }else if ($model->CRI_ID_PES10 == 'LEVE'){
                       return ['style' => 'background-color: #FFFF99']; 
                      // return ['class' => GridView::TYPE_WARNING];
                    }
            },
            // set your toolbar
            'toolbar' =>  [
                [
                    /*'content' =>
                        Html::button('<i class="fas fa-plus"></i>', [
                            'class' => 'btn btn-success',
                            'title' =>  'Add Book',
                            'onclick' => 'alert("This will launch the book creation form.\n\nDisabled for this demo!");'
                        ]) . ' '.
                        Html::a('<i class="fas fa-redo"></i>', ['grid-demo'], [
                            'class' => 'btn btn-outline-secondary',
                            'title'=>'Reset Grid',
                            'data-pjax' => 0, 
                        ]),
                    'options' => ['class' => 'btn-group mr-2']
                     * 
                     */
                ],
                '{export}',
                '{toggleData}',
            ],
            'toggleDataContainer' => ['class' => 'btn-group mr-2'],
            // set export properties
            'export' => [
                'fontAwesome' => true
            ],
            'panel' => [
                'type' => GridView::TYPE_DEFAULT,
                //'heading' => true,
                'heading'=>'<h3 class="panel-title"><i class="glyphicon glyphicon-globe"></i> '.$searchModel->APP_COMPONENTE.'</h3>',
                //'before'=>Html::a('<i class="glyphicon glyphicon-plus"></i> Create Country', ['create'], ['class' => 'btn btn-success']),
                //'after'=>Html::a('<i class="fas fa-redo"></i> Reset Grid', ['index'], ['class' => 'btn btn-info']),
                //'footer'=>false,
            ],
            // parameters from the demo form
            //Configuración de la páginacíón.
            'pager' => [
                'options'=>['class'=>'pagination'],   // set clas name used in ui list of pagination
                'prevPageLabel' => 'Anterior',   // Set the label for the "previous" page button
                'nextPageLabel' => 'Siguiente',   // Set the label for the "next" page button
                'firstPageLabel'=>'Primera',   // Set the label for the "first" page button
                'lastPageLabel'=>'Última',    // Set the label for the "last" page button
                'nextPageCssClass'=>'next',    // Set CSS class for the "next" page button
                'prevPageCssClass'=>'prev',    // Set CSS class for the "previous" page button
                'firstPageCssClass'=>'first',    // Set CSS class for the "first" page button
                'lastPageCssClass'=>'last',    // Set CSS class for the "last" page button
                'maxButtonCount'=>8,    // Set maximum number of page buttons that can be displayed
            ],      
            'showPageSummary' => false,
            'persistResize' => false,
            'toggleDataOptions' => ['minCount' => 10],
            'exportConfig' => true,
            'itemLabelSingle' => 'vulnerabilidad',
            'itemLabelPlural' => 'vulnerabilidades',
            'resizableColumnsOptions'=> ['resizeFromBody' => true],

        ]);
        ?>
    <?php// };?>
    <?php //Pjax::end() ?>    

File plan-details.php (contains the detailview)

echo DetailView::widget([
'model'=>$model,
'attributes'=>$attributes,
'condensed'=>true,
'hover'=>true,
'mode'=>DetailView::MODE_VIEW,
'panel'=>[
'type'=>DetailView::TYPE_INFO,
],
'formOptions' => [
'action' => Url::toRoute(['sec-pa-plan/save-plan-details','APP_COMPONENTE'=>$model->APP_COMPONENTE,'APP_GERENCIA'=>$model->APP_GERENCIA,'PA_ID_VUL'=>$model->PA_ID_VUL]),
//'options' => ['data-pjax' => true],
'id' => 'plan-form-view',
'method' => 'post'
],
]);

Expected behavior and actual behavior

I have a grid with an Expand Column Row column. This column includes a DetailView. When I clicked the update icon it switched to edit mode and when I clicked the view icon it went back to view mode.
It was working a while ago, but since I've updated the project this functionality has been lost and no buttons work.

Environment

Dev

Browsers

It happens with all browsers.

  • [ X] Google Chrome
  • [ X] Mozilla Firefox
  • [ X] Internet Explorer
  • [ X] Safari

Operating System

  • Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version:
  • yii2-detail-view version:

Isolating the problem

  • This bug happens on the demos page
  • The bug happens consistently across all tested browsers
  • This bug happens when using yii2-detail-view without other plugins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant