I have a gridView and i managed to get it to contain the data i need, but what i need to do next is to create a column which contains two buttons for has_facebook and has_twitter.
<?=
GridView::widget([
'dataProvider'=>$dataProvider,
'filterModel' =>$searchModel,
'columns' =>[
['class'=>'yii\grid\SerialColumn'],
'name',
'cm_name',
'has_facebook',
'has_twitter',
['class'=>'yii\grid\ActionColumn'],
],
]);
?>
name | cm_name | platforms
account1 | jack | btn1 btn2
where btn1 and btn2 refer to facebook and twitter.
sorry for the disfigured table.
You don't need to create own column Class. You can create simple raw-column and show there anything you want:
This function
names callback function. There is core method evaluateExpression in CComponent:
in our case expression is not string, it's a function, so it runs php method call_user_func_array and pass into it your model.
Just a tip: If you are rendering complex data, this was would be helpful in Yii2..
or you can use
and the partial view could be something like