Mixing filters and ordering
Let's take a look at a more advanced example of mixing both custom filters and custom ordering. This time, we'll setup the Movies class from our past examples so it can work with movies released between two given years, and it can order the results by their release year and by their title:
That's it, did you get it? Now we can use our new Movies
class to get a neat list of movies released in the glorious 80's, ordered by their release year and title, check this out:
Note that to get a listing ordered both by release year and title at the same time, instead of defining a single order in the
fillFromParameters
method, we define two, and then we apply both of them when instantiating ourMovies
object, by passing the array["released", "title"]
in theorder
key.
See this example working in the Cherrycake documentation examples site.
Last updated