gridview with my own filter

hi, I want the Gridview display ordered by a condition created by me , I tried it on my ModelSearch , that works , but then not let me filter or sorted alphabetically, which part would have to put that condition. Thanks

Put order condition in key ‘defaultOrder’ of ActiveDataProvider, as:




$dataProvider = new ActiveDataProvider([

     'query' => $query,

     'sort'=> ['defaultOrder' => ['sort_field'=>SORT_ASC]]

 ]);



sorry, but I do not want that, what I need is to show only part of the information that is in my model, because the user only has permission to view that part, and I want to put the condition that if such user only see that information.

If you want filter grid’s columns based on user’s rights, use “visible” attribute of DataColumn.