i need an advice in how to design the following problem:
I have a list, no grid or something, generated from an action, e.g /site/action/10
That action generates a list with all entries where id= 10. These entries are presented in <div> containers on my site.
Now i want to add some ajax sort and filter features to sort or limit the list (in detail: sorting by price and/or filter by price between 5 and 10, …).
My first Idea was to create a FilterController, which handles the actions from the different ajax sort/filter links, like a CDbCriteria builder class.
Then in the controller where the list gets generated, i check if there was some sort/filter stuff build and add it to the query.
But then i’ll have to call the action to display the list from the FilterController and i think thats not the right way how to do it.
As you may see in the wiki, you can replace the CGridView of gii-generated admin page with a CListView, where you can use ‘Advanced Search’ form to filter the list items.
First, add some attributes(public properties) to your model for those filtering parameters.
And then create a customized search() method in the model to return the CActiveDataProvider for the list.
Note that the ‘Advanced Search’ form uses an instance of the model, and it is meant for the container of the search parameters.