Sorting Works in 1st case and not in 2nd case.
'columns'=>['name'],
'columns'=>[
'label' => 'name',
'header' => 'Event Name',
'value' => function($model) {
return $model['name'];
}
],
you have incorrect column setup. please refer to official documentation for this case.
I have searched everything, but cannot find.
There must be attribute for sorting
'columns'=>[
'attribute' => 'name',
...
],
Yep, if no attribute is specified you can not sort.
Want to change Header, but when I add 'header', then Sort does not work.
[
'attribute' => 'name',
'header' => 'Event Name',
],
use label
.
@Ragazzo Why does 'header' affects sorting and 'label' does not?
because header will overwrite the full header cell content, while label defines that label that is used for the colum, i.e. to fill the header or to generate the link dependent on what is needed.
@cebe Thanks!
Most helpful comment
use
label
.