我想在grails中使用paginate標記,但它不工作。grails paginate不起作用
在控制器:
def show(Integer max) {
params.max = Math.min(max ?: 10, 100)
def etpse
def total
if (params.data == 'all') {
etpse = Enterprise.findAll()
total = Enterprise.count()
}
else {
def paramsLike = "%" + params.data + "%"
etpse = Enterprise.findAllByKeywordLike(paramsLike)
total = Enterprise.countByKeywordLike(paramsLike)
}
[etpseList: etpse, instanceTotal: total]
}
在GSP:
<div id='pagination'>
<g:paginate total="${instanceTotal}" />
</div>
如果該類不是一個帶有列表方法的域類,該怎麼辦?這只是一個POGO?如何編寫這樣的列表方法? – johnsam