开发者

grails searchable plugin sorting by enum type

开发者 https://www.devze.com 2023-04-04 09:43 出处:网络
I have a class PrintRequest with a an enum type (enum class is Status) property called \"theStatus\" and I want searchable to sort based on theStatus of the PrintRequest. I\'ve created a mapping:

I have a class PrintRequest with a an enum type (enum class is Status) property called "theStatus" and I want searchable to sort based on theStatus of the PrintRequest. I've created a mapping:

static mapping = {theStatus type:"integer"} 

in my PrintRequest domain class, but the search method still doesn't do any sorting. I call the search method like this:

PrintRequest.search(queryString, [sort:aParams.sort, order:aPar开发者_如何学Cams.order, offset: aParams.offset, max:ApplicationHolder.application.config.printRequest.PrintRequest.defaultMax])

where aParams.sort = "theStatus" and aParams.order = "asc"

Why isn't searchable working? It returns a list of PrintRequest that match the query string, but it doesn't sort based on theStatus.

PrintRequest.groovy looks like

class PrintRequest {
    static searchable = true
    ...
    Status theStatus
    ...

    static constraints = {
        ...
        theStatus()
        ...
    }

    static mapping = {theStatus type:"integer"}
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号