Grails: filter data in a Grails table dynamically

前端 未结 2 840
臣服心动
臣服心动 2020-12-29 16:58

I have a table, with a series of events, name of my class is Entry.

Here is a picture of my table

is in Spanish, but the basics are the same so it shouldn\'t

2条回答
  •  青春惊慌失措
    2020-12-29 17:52

    Sounds like you want to show the search results in a 'list' view, so they show up in a table just like when unfiltered. You can just reuse that view and pass in the filtered results as the instance list.

    Do you have views for your Entry domain object? If not, generate some scaffolding views with grails generate-view Entry. Then in your controller, make your searchResults method look something like this:

    def searchResults = {
        def entryInstanceList = Entry.list() // replace with actual filtering logic
        render(view:'list', model: [entryInstanceList: entryInstanceList])
    }
    

提交回复
热议问题