source: trunk/grails-app/views/advancedQuery/sampleresults.gsp @ 1524

Last change on this file since 1524 was 1524, checked in by robert@…, 13 years ago

Refactored some of the querying stuff and built in 'check all' checkboxes

  • Property svn:keywords set to Rev Author Date
File size: 2.4 KB
Line 
1<html>
2<head>
3        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
4        <meta name="layout" content="main"/>
5        <title>Query results</title>
6        <link rel="stylesheet" href="<g:resource dir="css" file="advancedQuery.css" />" type="text/css"/>
7        <g:javascript src="advancedQueryResults.js" />
8</head>
9<body>
10
11<h1>Query results</h1>
12
13<div class="searchoptions">
14        ${search.getNumResults()} <g:if test="${search.getNumResults() == 1}">sample</g:if><g:else>samples</g:else> found with
15        <g:render template="criteria" model="[criteria: search.getCriteria()]" />
16</div>
17<g:if test="${search.getNumResults() > 0}">
18        <%
19                def resultFields = search.getShowableResultFields();
20                def extraFields = search.getShowableResultFieldNames(resultFields);
21        %>
22        <table id="searchresults" class="paginate">
23                <thead>
24                <tr>
25                        <th class="nonsortable"><input type="checkbox" id="checkAll" onClick="checkAllPaginated(this);" /></th>                 
26                        <th>Name</th>
27                        <th>Study</th>
28                        <g:each in="${extraFields}" var="fieldName">
29                                <th>${fieldName}</th>
30                        </g:each>
31                </tr>
32                </thead>
33                <tbody>
34                <g:each in="${search.getResults()}" var="sampleInstance" status="i">
35                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
36                                <td width="3%">
37                                        <% /*
38                                                The value of this checkbox will be moved to the form (under this table) with javascript. This
39                                                way the user can select items from multiple pages of the paginated result list correctly. See
40                                                also http://datatables.net/examples/api/form.html and advancedQueryResults.js
41                                        */ %>
42                                        <g:checkBox name="id" value="${sampleInstance.id}" checked="${false}" onClick="updateCheckAll(this);" />
43                                </td>
44                                <td>${fieldValue(bean: sampleInstance, field: "name")}</td>
45                                <td><g:link controller="study" action="show" id="${sampleInstance?.parent?.id}">${sampleInstance?.parent?.title}</g:link></td>
46                                <g:each in="${extraFields}" var="fieldName">
47                                        <td>
48                                                <%
49                                                        def fieldValue = resultFields[ sampleInstance.id ]?.get( fieldName );
50                                                        if( fieldValue ) {
51                                                                if( fieldValue instanceof Collection ) {
52                                                                        fieldValue = fieldValue.collect { it.toString() }.findAll { it }.join( ', ' );
53                                                                } else {
54                                                                        fieldValue = fieldValue.toString();
55                                                                }
56                                                        } else {
57                                                                fieldValue = "";
58                                                        }
59                                                %>
60                                                ${fieldValue}
61                                        </td>
62                                </g:each>
63                        </tr>
64                </g:each>
65                </tbody>
66        </table>
67        <g:render template="resultsform" />
68
69</g:if>
70<g:render template="resultbuttons" model="[queryId: queryId]" />
71</body>
72</html>
Note: See TracBrowser for help on using the repository browser.