Pergunta

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.

Foi útil?

Solução

please can you see and post the inspection result on your browser like

1. goto inspect window and network

2. press the `g:sortablecolumn` and see if anything is posted or a request ? 

3. if yes , that is how i can resolve this issue and you should to ..see which 
   object/parameteris passed to 
   the controller so that you can play with the code.

4.if not Syntax error please first try with simple settings and correct 
    to see how it   works on 1,2,3 steps.

cheers am sure you will find the solution !!

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top