Modal popup update form, from a link in GridView

Hello:

I have a GridView that shows rows of info from related tables.

I’ve managed to make every row has a link to his update form page with this code:




        'columns' => [

            [

                'label' => 'Spraying',

                //'attribute' => 'numero_spraying',

                'format' => 'raw',

                'value' => function ($model, $key, $index) {

                    return Html::a($model->numero_spraying, ['spraying/'.'update', 'id' => $model->id_spraying]);

                },

                'width' => '100px'

            ],



But I need to make that on clicking the link the update form pop in a modal window, because there will around 50 rows in this GridView, and they will need to be modified frequently, so going back and forth is not so good.

This is howit looks now:

Hi Felipe.

You should use CGridView extension of Kartik. I think it is just what you need

Grid-Editable. Here is all the settings you might need

If you need help with anything you can contact me

Thank you gifrancohe, but what I need is slightly different.

I need to load the update form of the model, not just one field as in the EditableColumn by Kartik.

i would

  • create a bootstrap modal

  • create an ajax view

  • bind the links to onClick event which display the modal and load the ajax view of the form you want

  • ajax submit your form

Check out the below resources:

http://www.mushtaqtahir.com/blog/3/yii2-ajax-form-submission