g:sortableColumn - &gt;执行标记<g:sortablecolumn>时出错:null </g:sortablecolumn>

时间:2012-03-07 15:46:19

标签: grails grails-plugin

我遇到了困难,我不明白有什么不对。 我认为它与FilterPane插件有关,我也使用它,但我不确定...

这里是list.gsp中的代码:

    <table>
      <thead>
        <tr>
           <g:sortableColumn property="id" title='${message(code:"doi.doi.string")}' params="${filterParams}"/>               
           <g:sortableColumn property="url" title='${message(code:"doi.doi.url")}' params="[filterParams]"/>
           <g:sortableColumn property="registrationDate" title='${message(code:"doi.doi.registration.date")}' params="${filterParams}"/>
           <g:sortableColumn property="lastUpdateDate" title='${message(code:"doi.doi.last.update.date")}' params="${filterParams}"/>
           <g:if test="${session.user.isAdmin}">
              <g:sortableColumn property="owner" title='${message(code:"doi.doi.user")}' params="${filterParams}"/>
           </g:if>                   
       </tr>
      </thead>
      ...
      <div class="paginateButtons">
        <g:paginate total="${doiCount == null ? '0' : doiCount}" params="${filterParams}"/>
        <filterpane:filterButton text='${message(code:"button.search")}'/>
        <filterpane:filterPane domain="Doi"
                    titleKey="fp.tag.filterPane.titleText"
                    additionalProperties="id"
                    dialog="true"
                    excludeProperties="OAIServerLocation, source,title, creator, dimension, value, unit, contributor, publisher, language,
                                                          description, structuralType, mode, resourceType, registrationAgency, issueDate, issueNumber,
                                                          publicationDate, publicationPlace, discipline, relatedDOIs, relatedDOI, relationType"
                    associatedProperties="owner.lastName"
                    filterPropertyValues="${[registrationDate:[years:2013..2009,precision:'day'],
                                                               lastUpdateDate:[years:2013..2009,precision:'day']]}"/>
      </div>

以及我在控制器中定义的内容;

class DoiController
{
  ...
  def filterPaneService;
  ...
  def filter =
    {
      if(!session.user)
      {
          loadUser();
      }

      flash.args = [session.user.firstName, session.user.lastName];

      if(!params.max)
      {
          params.max = 20;
      }

      render( view:'list', model:[doiList: filterPaneService.filter(params, Doi), 
      doiCount: filterPaneService.count(params, Doi), 
      filterParams: org.grails.plugin.filterpane.FilterPaneUtils.extractFilterParams(params), params:params])
    }
  ...

当我在浏览器中启动应用程序时,我得到:

Error 500:
Servlet: gsp
URI: /doi/
Exception Message:
Caused by: Error processing GroovyPageView: Error executing tag &lt;g:sortableColumn&gt;: null at C:/eclipse-jee-galileo/Workspace/doi/grails-app/views/doi/list.gsp:48
Class: /WEB-INF/grails-app/views/doi/list.gsp
At Line: [-1]
Code Snippet:

和第48行是<g:sortableColumn property="url" title='${message(code:"doi.doi.url")}' params="[filterParams]"/>

如果我删除此行,那么它可以正常工作......

有人可以帮帮我吗?我真的很绝望! 如果需要其他信息,请询问。

我正在使用grails 1.3.7和Filterpane-Plugin 2.0.1.1

1 个答案:

答案 0 :(得分:1)

很抱歉,如果你已经解决了这个问题 - 我唯一注意到的就是那条线你有

    params="[filterParams]"

而不是

    params="${filterParams}"