GAMITG GAMITG - 7 months ago 13
PHP Question

After filtering value than enable sorting link on relational field in Grid View Yii2

When I first time filter or sort the field of gridview ,after that enable the relational data field sorting link,
so, how can i solve this issue.

Here i attached two image that describe the before filtering or sorting and after that.

Link Url :

before filter: http://i.stack.imgur.com/bDJoG.png
after filter: http://i.stack.imgur.com/lXnfY.png

Updated:

I have a two table one of is

student_info
and second one is
student_trans
. and i create relation
student_info_id (primary key)
with
student_trans_info_id
like
(student_info_id = student_trans_info_id)
,

Now in
student_trans
grid view i used the student_info's
first_name
and
last_name
field with sorting and filtering, but these relational field's sorting link enable after filter or sort the any filed of
student_trans
grid view field.

Answer

After do googling i found my mistake.

My mistake was that i added $dataProvider->sort->attributes[] code after $this->load(); function; so it mean after loading the filtered data than enable sorting link.

Now, i resolved my mistake with put the $dataProvider->sort->attributes[] before $this->load(); function.

Thanks to **@Paul van Schayck** post....