Adding search/filter to a scaffolded list.gsp
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开发者_Python百科, 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...
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).
Check this blog post - https://blog.uni-koeln.de/rrzk-knowhow/2012/03/14/add-filter-pane-to-your-customized-scaffolded-templates-for-list-pages/
Only downside is need some styling re-work for the filterpane to look neat.
filterpane:2.0.1.1 Grails 2.0.4
精彩评论