여러 테이블이 포함 된 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>
그렇게 문제