mercredi 28 janvier 2015

Table Sorting in gsp contaning sql rows passed by controller


Vote count:

0




I am using sortablecolumn feature of Grails to dynamically sort the table columns in gsp. I have 3 table's containing sql rows passed by controller code.


My Controller code is:



def ABC{
def A= AService.a()
def B=BService.b()
def C=CService.b()
render(view:list,model:[A:A,B:B,C:C])
}


AService, BService, and CService contains sql code and returns the rows.


My list.gsp code is:



<body>
<div class="body">
<h1>ABC</h1>
<g:if test="${flash.message}">
<div class="message">${flash.message}</div>
</g:if>
<div class="list">
<table>
<thead>
<tr>
<g:sortableColumn property="name" title="NAME" />
<g:sortableColumn property="id" title="ID" />


<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<g:each in="${A}" status="i" var="thisRecord">
<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
<td>${thisRecord.name}</td>
<td>${thisRecord.id}</td>


</tr>
</g:each>
</tbody>
</table>
</div>
</div>
</body>
</html>


And two other tables. Whenever I click on the columns on front end the tables are not sorting correctly. Please correct me where I am going wrong.



asked 31 secs ago







Table Sorting in gsp contaning sql rows passed by controller

Aucun commentaire:

Enregistrer un commentaire