Difference using _search and filter in GridView

I don’t understand the difference between using _search.php in index.php and put some filter upside the column with GridView: the result is the same.
Maybe with complicated search and more database, with _search is more simple ?
Thanks

You are right, @Drugo66

  • GridView filter
    • only the visible columns can be used
    • conditions are combined using “AND” only
  • _search.php
    • you can use any columns even if they are not in the grid view
    • you can construct whatever condition you like

For relatively simple conditions, they work almost in the same way. And as they both call the controller action in the same manner, you don’t have to write the different code for searching in the search model’s search() function.

Thank you, @softark