تغییر کلاس gridview
به صورت پیش فرض استایل GridView به این صورت است :
<div class="grid-view">
برای تغییر کلاس div به شکل زیر عمل می کنیم .
'filterModel' => $searchModel,
'columns' => [
['class' => 'yiigridSerialColumn'],
.........
['class' => 'yiigridActionColumn'],
],
'options'=>['class'=>'grid-view gridview-newclass'],
]); ?>
برای تغییر کلاس جدولی که دیتا ها را نمایش می دهد نیز به این صورت عمل می کنیم
<table class="table table-striped table-bordered">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yiigridSerialColumn'],
.........
['class' => 'yiigridActionColumn'],
],
'tableOptions' =>['class' => 'table table-striped table-bordered'],
]); ?>
و در آخر تغییر ظاهر هر سطر از جدول
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yiigridSerialColumn'],
.........
['class' => 'yiigridActionColumn'],
],
'rowOptions'=>function ($model, $key, $index, $grid){
$class=$index%2?'odd':'even';
return array('key'=>$key,'index'=>$index,'class'=>$class);
},
]); ?>
برچسب:
نویسنده: پندار توکلی