how can i use pagenation with a controller in side show page of another controller this is my code:
plan controller:
def show = {
if (!params.max) params.max = 4
if (!params.offset) params.offset = 0
def planInstance = Plan.get(params.id)
def planVoiceServiceListCount = PlanVoiceService.countByPlan(planInstance)
def planVoiceServiceList = PlanVoiceService.findAllByPlan(planInstance, [max: params.max as Integer, offset: params.offset as Integer])
if (!planInstance) {
flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'plan.label', default: 'Plan'), params.id])}"
redirect(action: "list")
}
else {
[planInstance: planInstance,
planVoiceServiceList: planVoiceServiceList,
planVoiceServiceListCount: planVoiceServiceListCount]
}
}
and plan\show.gsp:
<div class="dialog">
<table align="left">
<thead>
<tr>
<th>${message(code:'plan.services.voice.label', default:'Voice Service Name') }</th>
<th>${message(code:'plan.services.voice.label', default:'Voice Service Description') }</th>
<th>${message(code:'plan.services.voice.maxsessions.label', default:'Max Simultaneous Calls') }</th>
<th>${message(code:'plan.services.voice.tariff.label', default:'Voice Tariff') }</th>
<th>${message(code:'plan.services.voice.services.label', default:'Calling Destination Group') }</th>
<th>${message(code:'plan.services.voice.services.label', default:'Plan Voice Service Minute') }</th>
<th>${message(code:'plan.services.voice.services.label', default:'Plan') }</th>
</tr>
</thead>
<tbody>
<g:each in="${planVoiceServiceList}" status="i" var="planVoiceServiceInstance">
<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
<gsec:hasRole name='Administrator'>
<td><gti:link controller = "planVoiceService" action="show" id="${planVoiceServiceInstance.id}">${fieldValue(bean: planVoiceServiceInstance, field: "voiceService.name")}</gti:link></td>
</gsec:hasRole>
<gsec:hasRole name='Company'>
<td>${fieldValue(bean: planVoiceServiceInstance, field: "voiceService.name")}</td>
</gsec:hasRole>
<td>${fieldValue(bean: planVoiceServiceInstance, field: "voiceService.description")}</td>
<td>${fieldValue(bean: planVoiceServiceInstance, field: "maxSessions")}</td>
<gsec:hasRole name='Administrator'>
<td><g:link controller="voiceTariff" action="show" id="${planVoiceServiceInstance.voiceTariff.id}">${fieldValue(bean: planVoiceServiceInstance, field: "voiceTariff.description")}</g:link></td>
</gsec:hasRole>
<gsec:hasRole name='Company'>
<td>${fieldValue(bean: planVoiceServiceInstance, field: "voiceTariff.description")}</td>
</gsec:hasRole>
<td>${fieldValue(bean: planVoiceServiceInstance, field: "callingDestinationGroup.name")}</td>
<td>${fieldValue(bean: planVoiceServiceInstance, field: "planVoiceServiceMinute")}</td>
<td>${fieldValue(bean: planVoiceServiceInstance, field: "plan.description")}</td>
</tr>
</g:each>
</tbody>
</table><br /><br /><br /><br />
<div class="paginateButtons">
<g:paginate controller="plan" action="show"
total="${planVoiceServiceListCount}"
>
</g:paginate>
</div>
what's error in my code?????? the data appers but when i click to go to second pagenation page null id error appears