title: Yii2 Modal on Gridview row
body: <p>My Modal window is only displayed on the first line of Gridview (clicking on the second line or more opens a new page without formatting). </p>
  
  <p>I was following this <a href="https://stackoverflow.com/questions/32919282/modal-pop-up-in-grid-view-in-yii2">post</a>.</p>
  
  <p>Can someone help me? I saw that there is an unanswered topic for the same problem here <a href="https://stackoverflow.com/questions/42667602/yii2-gridview-modal-only-display-when-click-on-first-row"> https://stackoverflow.com/questions/42667602/yii2-gridview-modal-only-display-when-click-on-first-row</a></p>
  
  <p><strong>My gridview</strong></p>
  
  <pre><code>&lt;?php
      yii\bootstrap\Modal::begin([
        'id' =&gt;'modal',
        //'headerOptions' =&gt; ['id' =&gt; 'modalHeader'],
        'header' =&gt; 'Tipos de situação',
      ]);
      yii\bootstrap\Modal::end();
  ?&gt;
  </code></pre>
  
  <p><strong>columns...</strong></p>
  
  <pre><code>    [
        'attribute' =&gt; 'status_id',
        'enableSorting' =&gt; true,
        'format' =&gt; 'raw',
        'value' =&gt; function ($model) {
                // return '&lt;b style="color:#456789"&gt;'.$model-&gt;status-&gt;name.'&lt;/b&gt;';
                // },
                return Html::a($model-&gt;status-&gt;name, ['/analise/status/list'], ['id' =&gt; 'popupModal']);      
        },
        'filter' =&gt; ArrayHelper::map(Status::find()-&gt;orderBy('name')-&gt;asArray()-&gt;all(), 'id', 'name'),
        'contentOptions'=&gt;['style'=&gt;'width: 10%;text-align:center;vertical-align: middle;'],
        'headerOptions'=&gt;['class'=&gt;'active', 'style'=&gt;'text-align:center;vertical-align: middle;'],
      ],
  
      &lt;?php
  $this-&gt;registerJs("$(function() {
     $('#popupModal').click(function(e) {
       e.preventDefault();
       $('#modal').modal('show').find('.modal-body')
       .load($(this).attr('href'));
     });
  });");
  ?&gt;
  </code></pre>