title: Passing data from gridview button to modal window
body: <p>I am trying to pass data from a button within a gridview to a modal window. I need to pass the ID of the record in order to be able to reference it after submitting the form within the modal window. </p>
  
  <p>I am struggling with this quite a bit. First I need to be able to pass the ID variable to the modal, and then upon clicking the submit button make an ajax call to create a new record within the DB. </p>
  
  <p>The Gridview</p>
  
  <pre><code>if(isset($results)){
      $this-&gt;widget('bootstrap.widgets.TbExtendedGridView', array(
          'id'=&gt;'searchgrid',
          'fixedHeader' =&gt; true,
          'headerOffset' =&gt; 40, // 40px is the height of the main navigation at bootstrap
          'type'=&gt;'condensed',
          'dataProvider'=&gt;$results,
          'responsiveTable' =&gt; true,
          'template'=&gt;"{items}",
          'columns'=&gt;array(
              array('name'=&gt;'title', 'header'=&gt;'Name'),
              array('name'=&gt;'city', 'header'=&gt;'City'),
              array('name'=&gt;'state', 'header'=&gt;'State'),
              array('name'=&gt;'leads', 'header'=&gt;'Leads', 'value'=&gt;'Parkslist::model()-&gt;leadRange($data["leads"])'),
              array('name'=&gt;'pastbid', 'header'=&gt;'Previous', 'value'=&gt;'Parkslist::model()-&gt;pastBid($data["pasthighbid"])'),
              array('name'=&gt;'currentbid', 'header'=&gt;'Current', 'value'=&gt;'Parkslist::model()-&gt;highBid($data["currenthighbid"], $data["secondhighbid"], $data["countcurrenthighbid"])'),
              array('name'=&gt;'minimumbid', 'header'=&gt;'Minimum', 'value'=&gt;'Parkslist::model()-&gt;minimumBid($data["currenthighbid"], $data["secondhighbid"], $data["countcurrenthighbid"])'),
              array('name'=&gt;'userhighbid', 'header'=&gt;'Your Bid'),
              array('name'=&gt;'placebid', 'header'=&gt;'Bid', 'value'=&gt;'CHtml::textField("bid" . $data["id"])', 'type'=&gt;'raw'),
              array('name'=&gt;'report', 'header'=&gt;'Report',
                  'value'=&gt;function($data){
                      $this-&gt;widget('bootstrap.widgets.TbButton', array(
                          'label' =&gt; 'Click me',
                          'type' =&gt; 'primary',
                          'htmlOptions' =&gt; array(
                              'data-toggle' =&gt; 'modal',
                              'data-target' =&gt; '#myModal',
                              'data-id' =&gt; '$data["id"]',
                          ),
                      ));
                  }
              ),
          ),
      ));
  }
  </code></pre>
  
  <p>The Modal</p>
  
  <pre><code>&lt;?php
  $this-&gt;beginWidget('bootstrap.widgets.TbModal', array('id' =&gt; 'myModal')); ?&gt;
  
      &lt;div class="modal-header"&gt;
          &lt;a class="close" data-dismiss="modal"&gt;&amp;times;&lt;/a&gt;
          &lt;h4&gt;Why should this park be removed?&lt;/h4&gt;
      &lt;/div&gt;
      &lt;form&gt;
      &lt;div class="modal-body"&gt;
          &lt;select&gt;
              &lt;option&gt;Duplicate&lt;/option&gt;
              &lt;option&gt;Closed&lt;/option&gt;
          &lt;/select&gt;
      &lt;/div&gt;
  
      &lt;div class="modal-footer"&gt;
          &lt;?php $this-&gt;widget('bootstrap.widgets.TbButton', array(
          'type' =&gt; 'primary',
          'buttonType'=&gt;'submit',
          'label' =&gt; 'Save changes',
          'url' =&gt; '#',
          'htmlOptions' =&gt; array('data-dismiss' =&gt; 'modal'),
      )); ?&gt;
          &lt;?php $this-&gt;widget('bootstrap.widgets.TbButton', array(
          'label' =&gt; 'Close',
          'url' =&gt; '#',
          'htmlOptions' =&gt; array('data-dismiss' =&gt; 'modal'),
      )); ?&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;?php $this-&gt;endWidget(); ?&gt;
  </code></pre>