开发者

grails searchable plugin sorting by enum type

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜