Answer the question
In order to leave comments, you need to log in
How to change handler route of kartik GridView or standard GridView?
I'm adding a GridView to the page via renderAjax and the column sorting contains the url of the action that renders the GridView, and not the one on the page of which it happens.
For example, a view is given along the route /user/index
, on which js is connected. In this js, another route is requested - in which html with a GridView is returned /user/components/detail-info
through renderAjax and sorting in it leads to , and not to .
How to fix? /user/components/detail-info?sort=
/user/index?sort=
Answer the question
In order to leave comments, you need to log in
you pass the DataProvider to the GridView, the DataProvider has a sort property that takes a Sort object, for example:
new DataProvider([
'query'=>...
'sort'=> new Sort([
'route'=>'/user/index'
])
])
new DataProvider([
'query'=>... ,
'sort'=> [
'route'=>'/user/index'
],
])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question