I am new to yii2. and learning it slowly. I am using yii2 gridview in my project I want to show hide columns dynamically. requires something like this [https://datatables.net/examples/api/show_hide.html =>demo is given in this link] but cant understand how to do this? can anybody help?
code=>
<?php
$gridColumns = [
['class' => 'yii\grid\SerialColumn'],
['class' => 'yii\grid\CheckboxColumn'],
[
'header' => '<input type="checkbox"> Name',//onclick of this checkbox show / hide the column
'attribute'=>'name',
],
'company_mail',
'no_employees',
'email:email',
.
.
.];
echo GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => $gridColumns,
]);
?>
also tried like this=> 'visible'=>false,
but it hides permanently... where to add if() condition ??
how to solve this ..can anyone solve?
also [Toggle Column visibility in Yii Framework is for cgridview can i use this one in yii2]