Answer the question
In order to leave comments, you need to log in
How to filter by sum of two columns in gridview?
It is necessary that the GridView filter by the sum of two values. I display in GridView
[
'attribute' => 'sum_goods',
'label' => 'Сумма за товар',
'value' => function ($model) {
return number_format($model->sum_goods + $model->sum_user_transport, 2, '.', ' ');
}
],
Answer the question
In order to leave comments, you need to log in
not in this implementation. Yii2 sorts at the SQL level. Accordingly, for sorting, you need to form the specified field using aggregate functions in the request for obtaining data, and only then sort by it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question