Remembering state of a Grails list page (Marcel Overdijk)

, , August 20th, 2008

Marcel Overdijk has written a couple of entries regarding a common problem faced when paginated views are involved and how he found a solution with Grails.

With the default Grails scaffolding each time you navigate away from the list page (e.g. going to the show page) the state of the list is lost when you return. This can be annoying when you paged to a certain page within the list.

His first attempt solves the problem right away at the source, in other words, at the controller’s action being invoked. The next iteration refactors the remembering strategy into its own method, and it includes a slicker syntax thanks to the Elvis operator. The last iteration is one step further into customization, in Marcel’s words

In my Grails project I’ve added a ‘restoreState’ method dynamically using the ExpandoMetaClass to all Controller classes. The method is simply added in BootStrap.groovy

Here are the links to each version and their code

The last iteration may as well be packaged in its own plugin don’t you think?

Tags: , ,

NLGUG Announced (Marcel Overdijk)

, , , August 8th, 2008

Marcel Overdijk has announced the creation of NLGUG (Netherland’s Groovy User Group) group site hosted at Google groups. The intention of this effort to start building up a network of Groovy & Grails developers in The Netherlands. If the group grows and people are interested in meeting up the better. Please consider joining the group if you are local to The Netherlands and you find Groovy & Grails to be among your favorite topics.

Tags: , , ,