tags:

views:

213

answers:

1

Hi, I've been looking in some of the latest Grails books and many open source projects for samples and best practices for adding search/filter functionality to scaffolded list.gsp:s, eg making it work with pagination and sorting etc. This may be a simple task, but being a Grails newcomer it would be of great benefit in having some thorough samples to look at.

The closest thing I've found is the FilterPane plugin, but that is a very general solution - so the code may be unnecessarily complex to retrofit to a more custom search/filter. Does anyone have or has anyone seen good sample code for this? I'm thinking it's a very common requirement so it must be out there...

+2  A: 

Check out http://jira.codehaus.org/browse/GRAILS-5225, it's a set of alternate scaffolding templates. They support filtering and searching (if you add searching plugin). The scaffolding templates take a bit to get working, but they will show you how to do things.

Another plugin to check out is the Criteria Plugin.

There is also UberScaffoling Plugin, which allows you to inject code into scaffolded templates, of which I am the author, but I haven't posted updated in a while and I think what's on there may have a bunch of bugs right now. Let me know if you are interested in it - I could email you the latest version (need to find the time to post on grails plugin repo).

Jean Barmash
Hi Jean,I tried the Uber Scaffolding and I confirm you that it didn't work in my app. I didn't investigate further because it was not a top-priority requirement for my grails app and I needed to move on. However, I really liked the idea behind this plugin and once your latest version will be updated, please do an announcement in the Grails nabble mailing-list because I will certainly be the first client :-).
fabien7474
Thanks you kindest Jean, those are some excellent links. The JIRA shows how to get filters in a straightforward SQL-understandable way ;-) The Criteria plugin is a bit more Grails magic, but very lean and mean. I have decided to go with Criteria plugin for now - and if I hit the wall I'll switch to the JIRA code. Thanks again!
wwwclaes
I just want to add that I finally settled on the FilterPane plugin, I ignored the FilterTag and used my own custom HTML form. I think it's a clean and nice solution to my filtering needs.
wwwclaes