Searchable Sortable List Page for ActiveRecord

Is there an easy way to automatically (or pseudo-automatically) convert a generated list page for a CActiveRecord-based class to a searchable and sortable list page?

Basically, I'd like the user to be able to search any field in the object as well as sort by any field.

Any ideas?  It seems like this would be an easy thing to automate rather than having to to code by hand for various classes.

Thanks!

hello,

that's a good question. I already made my lists sorted and paginated. works great.

Is there an easy way to make these columns searchable?

thanks

When you use CRUD with the yiic shell it will create those functionalities for a list page in which case it will paginate for you and set up sorting. However there is no search implementation on it.

If you'd like a sample: When your demo or test drive directory set up - go into the yiic shell and make a model based off a sample db table you have in your db. For our sake I'll use user (as a table for holding user information)

model user (creates the user model)

Crud user (sets up the basic 4 query actions for you)

That's it, then on your main page after index.php type ?r=user/list

or just type ?r=user and see everything it sets up.

The only downfall I see here is if you wanted to make your own model class and not implement a separate controller (ie, because the default site application handles user login and thus I tacked on user registration to the sitecontroller, it's not automated and I didn't create a UserController, with my User model).

Hope that helps.