2011-09-08 2 views
0

여러 테이블이 포함 된 gsp 페이지를 만들고 싶습니다. "테이블"이라는 용어는 데이터베이스 테이블이 아닌 그래픽 테이블 (태그)을 의미합니다. 테이블에는 정렬 가능한 헤더가 있어야합니다.gsp 페이지 당 여러 개의 정렬 가능 테이블 렌더링?

gsp 페이지에 하나의 테이블 만 있으면 기존 sortableColumn 및 paginate 태그를 사용하기 쉽습니다. 'params'지도에 관련 항목을 삽입합니다 (예 : 'sort = column4711'). 그러나 여러 그래픽 테이블이 페이지에 포함되어 있으면 쉽게 작동하지 않습니다. 문제는 관련된 컨트롤러가 매개 변수가 과 연결된 테이블을 알지 못한다는 것입니다 (즉, "sort = column4711"맵 항목이있는 경우 컨트롤러는 어떤 테이블에 속하는지 알 수 없습니다).

나는 현재 내가 아주 못생긴 고려 다음과 같은 솔루션의 생각입니다 :

<div class="list"> 
       <table> 
        <thead> 
         <tr> 

          <g:sortableColumn property="id" title="${message(code: 'user.id.label', default: 'Id')}" /> 

          <g:sortableColumn property="password" title="${message(code: 'user.password.label', default: 'Password')}" /> 

          <g:sortableColumn property="userId" title="${message(code: 'user.userId.label', default: 'User Id')}" /> 

          <g:sortableColumn property="userName" title="${message(code: 'user.userName.label', default: 'User Name')}" /> 


          <g:sortableColumn property="id" title="${message(code: 'bookDetails.id.label', default: 'Id')}" /> 

          <th><g:message code="bookDetails.bookId.label" default="Book Id" /></th> 

          <g:sortableColumn property="pages" title="${message(code: 'bookDetails.pages.label', default: 'Pages')}" /> 

          <g:sortableColumn property="price" title="${message(code: 'bookDetails.price.label', default: 'Price')}" /> 



          <g:sortableColumn property="id" title="${message(code: 'book.id.label', default: 'Id')}" /> 

          <g:sortableColumn property="author" title="${message(code: 'book.author.label', default: 'Author')}" /> 

          <g:sortableColumn property="bookId" title="${message(code: 'book.bookId.label', default: 'Book Id')}" /> 

          <g:sortableColumn property="bookName" title="${message(code: 'book.bookName.label', default: 'Book Name')}" /> 

          <g:sortableColumn property="category" title="${message(code: 'book.category.label', default: 'Category')}" /> 

         </tr> 

        </thead> 
        <tbody> 
        <g:each in="${userInstanceList}" status="i" var="userInstance"> 
         <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> 

          <td><g:link action="show" id="${userInstance.id}">${fieldValue(bean: userInstance, field: "id")}</g:link></td> 

          <td>${fieldValue(bean: userInstance, field: "password")}</td> 

          <td>${fieldValue(bean: userInstance, field: "userId")}</td> 

          <td>${fieldValue(bean: userInstance, field: "userName")}</td> 

         </tr> 
        </g:each> 

        <g:each in="${bookDetailsInstanceList}" status="i" var="bookDetailsInstance"> 
         <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> 

          <td><g:link action="show" id="${bookDetailsInstance.id}">${fieldValue(bean: bookDetailsInstance, field: "id")}</g:link></td> 

          <td>${fieldValue(bean: bookDetailsInstance, field: "bookId")}</td> 

          <td>${fieldValue(bean: bookDetailsInstance, field: "pages")}</td> 

          <td>${fieldValue(bean: bookDetailsInstance, field: "price")}</td> 

         </tr> 
          </g:each> 

        <g:each in="${bookInstanceList}" status="i" var="bookInstance"> 
         <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> 

          <td><g:link action="show" id="${bookInstance.id}">${fieldValue(bean: bookInstance, field: "id")}</g:link></td> 

          <td>${fieldValue(bean: bookInstance, field: "author")}</td> 

          <td>${fieldValue(bean: bookInstance, field: "bookId")}</td> 

          <td>${fieldValue(bean: bookInstance, field: "bookName")}</td> 

          <td>${fieldValue(bean: bookInstance, field: "category")}</td> 

         </tr> 
        </g:each> 




        </tbody> 
       </table> 
      </div> 

     </div> 
    <body> 

그렇게 문제

답변

0

원격 매김 플러그인 거기를 해결하기 위해 우리를 인도하시기 바랍니다. 수정해야 할 몇 가지 문제가 있었지만 수정 된 버전이 없습니다. (사용 해본 이후로는 오래되었습니다.) 기본적으로 전체 페이지를 렌더링하는 대신 Ajax를 호출합니다. remoteSortableColumn 및 remotePaginate에 대한 태그를 가져옵니다.

관련 문제