Gridview edit button to open modal

On my index page I have a button to ‘create’ a new sale model.




<?= Html::button('New Sale', ['value' => Url::to('index.php?r=sale/create'), 'class' => 'btn btn-primary', 'id' => 'modalButton']) ?>



The modal div code




        Modal::begin([

            'header' => '<h4>New Sale</h4>',

            'id' => 'modalCreateSale',

            'size' => 'modal-lg',

        ]);


        echo "<div id='modalContent'></div>";


        Modal::end();



I would like to do the same for the (kartik) gridview Edit button that is on the same page.

Can anyone suggest how I can have a second modal that opens the same form in another modal dialog ?

So firstly, how is that done using the "pen" icon in the gridview action column - where the create button above uses the Url::to, how can the same be done in the action column button.

And then, should it be the same modal div above, or do i create a second modal div for the edit version of the form ?

Hope that makes sense.

thx

As I understand you want to put 2 modals on the same page?

Or, one modal is the first you use and another one is for the grid items?

I could suggest https://youtu.be/aUAUsADp9ao and change the action that create to the update one.