grails - g:sortableColumn具有复杂的关联

标签 grails gsp grails-2.3

因此,我正在尝试对对象表(可交付成果)进行排序。我想对每个标题(客户端,项目,可交付成果)使用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进行排序,也会导致对每个项目的可交付成果进行重新排序,而不是根据客户或项目名称对整个列表进行重新排序。

为提供的任何帮助加油。

最佳答案

请问您可以在浏览器中看到并发布检查结果吗?

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.

欢呼声确定您将找到解决方案!

关于grails - g:sortableColumn具有复杂的关联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22618892/

相关文章:

grails - 添加键值以在gsp中进行映射

grails - 在 Grails 中查询域类关联

使用 JVM fork 时 Grails mixins 不起作用

java - 内存问题分析

mysql - Grails - [1 :N] Relationship issue

grails - 在 Grails 中,如何获得鉴别器值?

json - g:javascript环境中的Grails 2.3表达式输出错误

jquery - Grails + jQuery : formRemote onSuccess

grails - 使grails有条件地在组合框中选择一个项目

grails - Grails Spring Security插件类的首选软件包