Hi Nicolo,
How did you add the search button on DataGrid2? Is it a custom button? If yes, then you will have to build the logic for it.
If you want to use Mendix's out of the box search functionality, you need to use filters.
Add attributes you want to filter on through the 'Grid wide filterting' tab in your DataGrid2's properties.
You can then add the filters in the UI as Column filters or regular data filters.
I have a series of YouTube tutorials on DataGrid2, it might be helpful:
https://youtube.com/playlist?list=PLmd33Kj_G6JOFJOU_MbLUBlORUsN5P02h&si=DwNV5nAha731Enuy