Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The CButtonColumn template property should be in the format "{buttonName1} {buttonName2}" where some predefined buttons like "update", "view" are provided already by the cButtonClass.</p> <p>You then can override or define each button using the buttons array and each element of that array can contain the following elements:-</p> <pre><code>'buttonID' =&gt; array( 'label'=&gt;'...', // text label of the button 'url'=&gt;'...', // a PHP expression for generating the URL of the button 'imageUrl'=&gt;'...', // image URL of the button. If not set or false, a text link is used 'options'=&gt;array(...), // HTML options for the button tag 'click'=&gt;'...', // a JS function o be invoked when the button is clicked 'visible'=&gt;'...', // a PHP expression for determining whether the button is visible </code></pre> <p>)</p> <p>It sounds as though you will need to extend the CButtonColumn class to add extra options to the button property or even create another property.</p> <p>see : <a href="http://www.yiiframework.com/wiki/106/using-cbuttoncolumn-to-customize-buttons-in-cgridview/" rel="nofollow">http://www.yiiframework.com/wiki/106/using-cbuttoncolumn-to-customize-buttons-in-cgridview/</a></p> <p>and the class definition: <a href="http://www.yiiframework.com/doc/api/1.1/CButtonColumn#buttons-detail" rel="nofollow">http://www.yiiframework.com/doc/api/1.1/CButtonColumn#buttons-detail</a></p> <p>EDIT:</p> <p>Alternatively, you could do the whole thing in Javascript, define an Id column with a class such as "myDropDown"</p> <p>and then in Javascript/jQuery process the column along the lines of:-</p> <pre><code> Yii::app()-&gt;clientScript-&gt;registerScript('myGridView'," els=$('.myDropDown); els.each(function(el) { cellId=el.text(); var t = $(\"&lt;select id='cellId' class='mySelect'&gt;&lt;option value="edit"&gt;Edit&lt;/option&gt; ... &lt;/select&gt;\"); el.html(t); }); $('table.items .mySelect').live('click', function() { ...process click event }); ", CClientScript::POS_READY); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload