1
votes

i have this error when i click on the pagination button:
Error processing GroovyPageView: Tag [paginate] is missing required attribute [total] at /home/user1/workspace/adm-appserver-manager/grails-app/views/emailNotification/status.gsp:59

and my code is: in gsp:

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

</div>

in controller:

def status = {
    [
        emailNotificationInstanceList:EmailNotification.findAllByStatus(EmailNotification.Status.Sent, params ),
        emailNotificationInstanceTotal:EmailNotification.countByStatus(EmailNotification.Status.Sent)  
    ]
}

i mention total attribute but i don't know why this error appear

4
Could you please paste all of your controller code ? - fabien7474
def status = { [ emailNotificationInstanceList: EmailNotification.findAllByStatus(EmailNotification.Status.Sent, params ), emailNotificationInstanceTotal: EmailNotification.countByStatus(EmailNotification.Status.Sent)]} - user597987
this is the code in the controller i have - user597987

4 Answers

2
votes

Make sure that your controller is returning this parameter in your return or render. You should also add a default value in your controller or view, in case the source call fails.

<g:paginate total="${emailNotificationInstanceTotal?:0}" />

Or

emailNotificationInstanceTotal: EmailNotification.countByStatus(EmailNotification.Status.Sent)?:0
0
votes

The problem is that the emailNotificationInstanceTotal is null so you need to verify the value that is being sent from the controller or when this variable is being defined to make sure it is not null and has an int value that is 0 or higher.

0
votes

Try re-generating the controller. In my case, I had changed the domain class name once, but I havent re-generated the controller that caused me this error

0
votes

The grailsPaginationTag is basically used to handle the pagination for list that you render on a particular web page.

Here at Oodles Technologies, we work extensively with Grails Development.

For this plugins Just add one line in the config.groovy file .

compile ":remote-pagination:0.4.8"

Remote pagination plugins provides us tage for pagination using ajax without page loading. It provides us many tag for pagination for list of object you needed.

For Example:

public class Person{
   String name
   long id
   }

On controller

public class PersonController{

   def list{
   [list:Person.list()]
   }

   def filterPersonList{
   render('listTemplate',model:[count:Person.list().size(),list:Person.list()])
   }
   }

Now on your _listTemplate gsp

Action: name of the link to be used in the pagination

Total: size of the list

update : id of the div/span which contain the template

max: fetch max list

params:pass your own params

maxsteps: The number of step displayed for the pagination

This might help in getting rid of the error.

Hope it helps.