So I am trying to sort a table of objects(Deliverables). I want to use g:sortableColumn for each header(Client, project, deliverable). Currently I am trying to implement a solution found in this blog http://sguthula.blogspot.com/2011/05/implementing-advanced-search-in-grails.html but have had no success.
An example of my associations is as follows:
class Deliverable {
static belongsTo = [project: Project]
}
class Project {
Client client
static hasMany = [deliverables: Deliverable]
}
class Client {
String name
static hasMany = [projects: Project]
}
In my table I am trying to order by clients name.
<g:sortableColumn property="name" title="${message(code: 'deliverable.project.client.name.label', default: 'Client')}"></g:sortableColumn>
This is one of the more complex associations, but even if I try to sort by just project.name, it results in the deliverables for each project being reordered rather than the whole list being reordered based on client or project names.
Cheers for any assistance offered.