在索引方法中,我列出了特定播放器的记录。如何在Grails视图中对列进行排序
例如
def index() {
Player player = Player.get(params.playerId)
def records = Record.findAllByPlayer(player, params:params)
[records: records, playerInstance: player, params: params]
}
这是有效的,但没有可排序的列在视图中工作。
如何查找我需要排序的列以及如何在findAllByXXX中使用此信息?我搜索了谷歌,但没有找到任何不涉及简单的“Books.list(params)”模式的例子。
在视图中,我有sortableColumns:
<g:sortableColumn property="createdAt" title="${message(code: 'paymentRecord.created.label', default: 'Created at')} "
params="${params}" style="width: 15%;"/>
,我看到的参数在网址的结尾,例如:
/index/1?sort=credit&order=desc