GirdFilter for calculated attribute not stored in database

In one of my GridViews I have a column that is calculated manually by performing a bunch of logic on dates. The database alone can not calculate this attribute because it needs to be run through a simple algorithm to determine the "state" of the model. I can display this extra calculated column in my GridView but I have not been able to find a way to perform a filter on it since it has nothing to do with any database columns.

My active record model is called "Rental" and the derived attribute is called the "state". Is there any way to add a grid filter that can not be queried in the database? I believe the answer is no, but I thought I would ask here just in case someone has a solution.

Thanks.

I also believe you are right, unfortunately.

When you are working with ActiveDataProvider (or SqlDataProvider), "state" has to be calculated using sql in order to apply filter on it.

Have you considered using date related functions of db?

Thanks Softark, that is what I expected. I’ll try to put something together using the database somehow.