Ignore:
Timestamp:
Mar 30, 2010, 7:29:54 PM (14 years ago)
Author:
gav
Message:

Only show table headers in search views if there actually are results.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/views/assetDetailed/search.gsp

    r450 r467  
    9494            </g:if>
    9595
    96             <div class="list">
    97                 <table>
    98                     <thead>
    99                         <tr>
    100                        
    101                                 <g:sortableColumn property="id" title="Id" params="${filterParams}" />
     96            <g:if test="${assetInstanceList.size() > 0}">
     97                <div class="list">
     98                    <table>
     99                        <thead>
     100                            <tr>
     101                           
     102                                <g:sortableColumn property="id" title="Id" params="${filterParams}" />
    102103
    103                              <g:sortableColumn property="name" title="Name" params="${filterParams}" />
    104                        
    105                             <g:sortableColumn property="description" title="Description" params="${filterParams}" />
     104                                <g:sortableColumn property="name" title="Name" params="${filterParams}" />
     105                           
     106                                <g:sortableColumn property="description" title="Description" params="${filterParams}" />
    106107
    107                             <g:sortableColumn property="isActive" title="Is Active" params="${filterParams}" />
    108                        
    109                             <g:sortableColumn property="section" title="Section" params="${filterParams}" />
     108                                <g:sortableColumn property="isActive" title="Is Active" params="${filterParams}" />
     109                           
     110                                <g:sortableColumn property="section" title="Section" params="${filterParams}" />
    110111
    111                             <th></th>
    112                            
    113                         </tr>
    114                     </thead>
    115                     <tbody>
    116                     <g:each in="${assetInstanceList}" status="i" var="assetInstance">
    117                         <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}" onclick='window.location = "${request.getContextPath()}/assetDetailed/show/${assetInstance.id}"'/>
    118                        
    119                             <td>${fieldValue(bean:assetInstance, field:'id')}</td>
     112                                <th></th>
     113                           
     114                            </tr>
     115                        </thead>
     116                        <tbody>
     117                        <g:each in="${assetInstanceList}" status="i" var="assetInstance">
     118                            <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}" onclick='window.location = "${request.getContextPath()}/assetDetailed/show/${assetInstance.id}"'/>
     119                           
     120                                <td>${fieldValue(bean:assetInstance, field:'id')}</td>
    120121
    121                             <td>${fieldValue(bean:assetInstance, field:'name')}</td>                       
     122                                <td>${fieldValue(bean:assetInstance, field:'name')}</td>
    122123
    123                             <td>${fieldValue(bean:assetInstance, field:'description')}</td>
     124                                <td>${fieldValue(bean:assetInstance, field:'description')}</td>
    124125
    125                             <td>${fieldValue(bean:assetInstance, field:'isActive')}</td>
     126                                <td>${fieldValue(bean:assetInstance, field:'isActive')}</td>
    126127
    127                             <td>${fieldValue(bean:assetInstance, field:'section')}</td>
     128                                <td>${fieldValue(bean:assetInstance, field:'section')}</td>
    128129
    129                             <td>
    130                                 <g:link action="show" id="${assetInstance.id}">
    131                                     <img  src="${resource(dir:'images/skin',file:'database_go.png')}" alt="Show" />
    132                                 </g:link>
    133                             </td>
    134                        
    135                         </tr>
    136                     </g:each>
    137                     </tbody>
    138                 </table>
    139             </div>
     130                                <td>
     131                                    <g:link action="show" id="${assetInstance.id}">
     132                                        <img  src="${resource(dir:'images/skin',file:'database_go.png')}" alt="Show" />
     133                                    </g:link>
     134                                </td>
     135                           
     136                            </tr>
     137                        </g:each>
     138                        </tbody>
     139                    </table>
     140                </div>
     141            </g:if>
    140142            <div class="paginateButtons">
    141143                <g:paginate total="${assetInstanceTotal}" params="${filterParams}" />
Note: See TracChangeset for help on using the changeset viewer.