title: Yii Cgridview $.fn.yiiGridView.getSelection function doesn't work right away
body: <p>I have a cgridview on a yii application, and I have selectableRows set to only 1.
  I have the following javascript to catch the click event and copy the id of the row into a  texfield on the same view file (the id can't be shown on the gridview itself that's why I'm using getSelection).</p>
  
  <pre><code>$('#doctors-grid').on('click', 'table tbody tr', function() 
          {       
              var doctorID = $.fn.yiiGridView.getSelection('doctors-grid');   
              $('#doctorIDTextfield').val(doctorID);      
          });
  </code></pre>
  
  <p>The problem is that the id value is never copied into the textfield on the first click but instead you have to click a second time. Not to mention that when I start clicking many different rows the id values get wrong some times.</p>
  
  <p>Can anyone help? Thank you for your time.</p>