0

所以我正在尝试对一个对象表(可交付成果)进行排序。我想为每个标题(客户、项目、可交付成果)使用 g:sortableColumn。目前,我正在尝试实施在此博客http://sguthula.blogspot.com/2011/05/implementing-advanced-search-in-grails.html中找到的解决方案,但没有成功。

我的关联示例如下:

class Deliverable {
    static belongsTo = [project: Project]
}

class Project {
    Client client
    static hasMany = [deliverables: Deliverable]
}

class Client {
    String name
    static hasMany = [projects: Project]
}

在我的表中,我试图按客户名称订购。

<g:sortableColumn property="name" title="${message(code: 'deliverable.project.client.name.label', default: 'Client')}"></g:sortableColumn>

这是更复杂的关联之一,但即使我尝试仅按 project.name 排序,它也会导致对每个项目的可交付成果进行重新排序,而不是根据客户或项目名称对整个列表进行重新排序。

为提供的任何帮助而欢呼。

4

1 回答 1

1

请您在浏览器上查看并发布检查结果,例如

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.

干杯我相信你会找到解决办法的!!

于 2014-03-25T09:02:24.100 回答