How can I do an explode in GridView in Yii framework, PHP? -


this query:

select p.name p_name, p.id pid, p.description p_description,  group_concat(r.id separator ',') rids,  group_concat(r.name separator ',') rnames `profiles` p left join rights r on p.id = r.profile_id  p.app_id = 8 group p_name 

and gridview:

$this->widget('gridview', array(             'dataprovider' => $apps_list,             'id' => 'my_grid_view',             //'filter' => $filtersform,             'itemscssclass'=>'table',             'columns' => array(                 array(                     'name'    => 'rights',                     'type'    => 'raw',                     'value'   => 'chtml::tag("div",array(),"<span>".$data["rnames"]."</span>")',                     // 'value'=> 'chtml::encode($data["rnames"])',                     'filter'  => '',                 ),             ),            )); 

this generates column this:

enter image description here

what want create checkboxes each right(cancreate,canupdate,canaccess) if there exists. need explode("^^",$data["rnames"]). how can write explode in gridview ? thx

use anonymous function in value:

'value' => function($data) {     //do here whatever want     return chtml::tag("div",array(),"<span>".$data["rnames"]."</span>"); } 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -