English 中文(简体)
不工作于列表的边框
原标题:Pagination not working for list in grails

我无法在 GUI 中看到光滑按钮。 我在 GUI 中看到整个列表 。

def lists={
params.max = Math.min(params.max ? params.int( max ) : 10, 100) 
def submittedList=[],InstanceList=[]
submittedList=FicheRequest.executeQuery("select fr.id,fr.MOSSNumber from FicheRequest fr where  fr.status=?",[ Submitted ]) 
    if(submittedList.size()>0){
    def sortedSubmittedList=new MossNumberSorting().getSortedMossNo(submittedList as ArrayList[])
    sortedSubmittedList.each{sortedId->InstanceList.add(FicheRequest.get(sortedId))}
            }
    else
    flash.message="No Submitted Request exists in the queue"

    return [InstanceList:InstanceList, InstanceTotal: InstanceList.count()] 
}

在我使用的 gsp 中

<div class="paginateButtons">
            <g:paginate total="${InstanceTotal}" />
        </div>

我也看到 URL 的最大和抵消参数

http://localhost:9090/apps2/lists?offset=0&max=10

不知道问题在哪里,请建议一些解决办法

问题回答

You have probably forgotten to pass params to line:
submittedList=FicheRequest.executeQuery("select fr.id,fr.MOSSNumber from FicheRequest fr where fr.status=?",[ Submitted ])
try like this:
submittedList=FicheRequest.executeQuery("select fr.id,fr.MOSSNumber from FicheRequest fr where fr.status=?",[ Submitted ],[max:params.max,offset:params.offset])
See more details:
http://grails.org/doc/latest/ref/Domain%20Classes/executeQuery.html

我找到了一个粗略的解决方案, 用于插入我的阵列列表。 我可以通过完整的列表, 并用最大值和抵消值, 并获得我想在我看来显示的列表 :

http://www.intelligrape.com/blog/2010/09/14/grails-pagination-on-filtered-list/"rel="no follow" >http://www.intelligrape.com/blogs/2010/09/14/grails-pagination-on-filtered-list/

但这不是一个好解决方案,因为它需要装入所有数据库值以显示页数。我想到的一个解决方案是将域名实例以苔丝编号排序格式存储。 苔丝编号的格式有点复杂; 这就是为什么我在重审 DB 的所有实例后,正在使用比较器类来排序它。 我欢迎关于如何用摩斯编号排序格式或其它格式来保存实例的更好的想法。





相关问题
Pagination problem

I m using this code for my pagination, and I d like the user s choice to be persistent throughout the site (this has been solved so far)...the only problem now is that the session variable now is ...

mod rewrite problem with 2 parameters

I m trying to rewrite the categoy file of my shop system, I also integrated a pagination so I need to rewrite 2 parameters. it almost works, otherwise I wouldn t be posting in here this is the ...

Issues with pagination in ASP.NET MVC

I am trying to implementation the same pagination that is used in the NerdDinner ASP.NET. I am receiving the following error in my view, whenever the pagination starts to kick in. "A route named ...

Pagination in SQL Server

How do i limit the result of a query (in my case about 60K rows) and select only from the X row to the Y row? If I use ROW_NUMBER() I don t like my query because it involves 2 select queries .. one ...

Cakephp 1.2 Paginator and PassedArgs

Problem: when i have a search resultset with pagination, the links next, prev and numbers do not keep the search parameters. Seems to be a common problem. I searched everywhere on the internet, and ...

Flexible pagination in Django

I d like to implement pagination such that I can allow the user to choose the number of records per page such as 10, 25, 50 etc. How should I go about this? Is there an app I can add onto my project ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

热门标签