|
Hi All,
I'm trying to integrate jasperreports with grails and I can't get by passed an obstacle. I'm getting the following exception: groovy.lang.MissingPropertyException: No such property: chainModel for class: org.codehaus.groovy.grails.plugins.jasper.JasperService at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at java.lang.Thread.run(Thread.java:619) I'm trying to get the result printed from a search request to a PDF file. In my list.gsp a have added the tag <g:jasperReport action="createReport" controller="employee" format="PDF" jasper="all_employees" name="Employees"> </g:jasperReport> When clicking on the link the method createReport in employeeController is triggered. This is the createMethod: def createReport = { def employees = employeeService.searchAll(Employee, params) chain(controller:'jasper',action:'index',model:[data:employees],params:params) } And the the EmployeeService.searchAll is called. When searchAll is called I can see there is a result returned. But when getting to the last line the exception is thrown. I have pasted the entire method below. assert results instanceof PagedResultList [objectList: results, objectCount: results.totalCount] Can anybody help me out here? Kind regards, Josip def searchAll (Class objectType, properties) { def preference = securityService.getUserPreference() // retrieve stored searchParameters def sessionObject = sessionService.getSessionSearchAttributes() // properties.max = Math.min(properties.max ? properties.int('max') : preference.maxRecordsPerPageList, preference.maxRecordsList) def employees = Employee.createCriteria() def results = employees.list (max: properties.max, offset: (!properties.offset ? 0 : properties.offset)){ or { if (sessionObject?.object?.person?.firstName) { person { ilike('firstName', "%${sessionObject?.object?.person.firstName}%") } } } or { if (sessionObject?.object?.person?.lastName) { person { ilike('lastName', "%${sessionObject?.object?.person.lastName}%") } } } or { if (sessionObject?.object?.person?.address) { person { ilike('address', "%${sessionObject?.object?.person.address}%") } } } or { if (sessionObject?.object?.person?.dateOfBirth) { person { eq('dateOfBirth', sessionObject?.object?.person?.dateOfBirth) } } } or { if (sessionObject?.object?.person?.district) { person { eq('district', sessionObject?.object?.person?.district) } } } or { if (sessionObject?.object?.person?.suburb) { person { eq('suburb', sessionObject?.object?.person?.suburb) } } } or { if (sessionObject?.object?.person?.ward) { person { eq('ward', sessionObject?.object?.person?.ward) } } } or { if (sessionObject?.object?.department) { eq('department', sessionObject?.object?.department) } } or { if (sessionObject?.object?.organization) { eq('organization', sessionObject?.object?.organization) } } or { if (sessionObject?.object?.jobtitle) { eq('jobtitle', sessionObject?.object?.jobtitle) } } or { if (sessionObject?.object?.employeeNr) { eq('employeeNr', sessionObject?.object?.employeeNr) } } or { 'in'('organization', securityService.getAuthOrganizations()) } fetchMode('person', FM.EAGER) } assert results instanceof PagedResultList [objectList: results, objectCount: results.totalCount] } |
|
I think I had similar problem. Problem was that jasperReport is excepting list.
So this will give the error message you had chain(controller:'jasper',action:'index',model:[data: Person.get(1)],params:params) But this will work chain(controller:'jasper',action:'index',model:[data: Person.getAll([1])],params:params) So I think your problem was that your query didn't return list but one concrete instance. |
| Powered by Nabble | Edit this page |
