filtering CGridview on related tables

I am trying to do this not just for a single relation, but a grandchild relation.

I have found these posts. But the solution suggested will only work with small tables as it involves bringing the entire table into PHP and sorting there.

Are there any better solutions to this?

Does anyone know why CGridView does not filter on relations? Is there some fundamental problem?

The solution is to add a new property for receive the input of the filter i, then write a new line in the search function.

Follow the indication of the first post, is the a good example about how to edit the search function

Thanks Zac