php - Yii CGridView button - call parametrized javascript function -


i need create cgridview 1 button , make button call javascript function this:

$this->widget('zii.widgets.grid.cgridview', array(     'id' => 'projectcities',     'summarytext' => '',     'dataprovider' => $model->getcitiesprovider(),     'columns' => array(         'name',         'directional',         'customcount',         array(             'class'=>'cbuttoncolumn',             'template'=>'{delete}',             'buttons' => array(                 'delete' => array(                     'url' => '',                     'click' => '',                     'options' => array(                         'onclick' => 'removecity(this, $data->idcity,                                        $model->idproject); return false;',                     ),                                           )             ),         )     ),     )); 

ofcourse it's not working, because generated html is:

<a class="delete" title="delete" onclick="removecity(this, $data->idcity, $model->idproject); return false;"> 

is there way there proper id in javascript function call?

//controller: public function gridbuttons($model) {        return array(         'class'=>'cbuttoncolumn',         'template'=>'{delete}',         'buttons' => array(             'delete' => array(                 'url' => '',                 'click' => '',                 'options' => array(                     'onclick' => sprintf(                         'js:removecity(this, %d, %d);return false;',                         $model->idcity, $model->idproject                     ),                 ),                                       )         ),     ) } //view $this->widget('zii.widgets.grid.cgridview', array(     'id' => 'projectcities',     'summarytext' => '',     'dataprovider' => $model->getcitiesprovider(),     'columns' => array(         'name',         'directional',         'customcount',         array(                         'value' => array($this, 'gridbuttons'),                     ),             ), )); 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -