sort List ใน views ที่มาจาก Relation แบบ hasMany ใน grails
- by NAzT
>
ไม่ Blog ยาว ขอสั้นๆ
มี Domain แบบนี้
package com.nazt class Experiment { static hasMany = [data:DataKeeper] String name = '[Experiment #]' Integer total Date dateCreated Date lastUpdated static constraints = { name(unique:true) } String toString() { name } }
code เดิมๆ ใน views มันเป็นแบบนี้
<g:each in=”${experimentInstance.data}” var=”d”>
ก็แก้ให้มันเป็นแบบนี้
<g:each in=”${experimentInstance.data.sort { it.id } }” var=”d”>
ก็เลยได้แบบนี้

Related Blogs
- » Learning to use CSS and DIV Tags for Columns in Dreamweaver
- Privacy — A Setback for Google? « ResourceShelf
- Sheer class (1): how the Labour party won the election « Though …
- HTML Pro Series Tutorial – #1 Working With DIV & Setting Up | HTML …
- Advance band div coding video 2 | geeksonsteroids.us
- Color Survey Results « xkcd
- SENIOR Magazine, RGB Eye Associates, Glaucoma Treatments | Senior …
- Elizabeth Warren: Death of the Middle Class » Tarp, Bear, Brothers …
- Tag Ladies Watch – Class On Every Occasion Now Affordable For You …
- On-Page Optimization: Step 2 ? Meta Tag Optimization « TagFocus.com
- Tag Formula 1 Watches – Discover How You Can Afford To Own A Piece …
- Buy Luxury Tag Heuer Watches and Be a Rich Man without Paying More …
- Can i cancel a zune tag? « TagFocus.com
- The Convenience of A Single Dog Tag « TagFocus.com
- I am thinking about writing a movie script. Tell me what you think …
- Drug That Extends Life Span Prevents Alzheimer's Deficits | www …
- What Is Wrong On The Photo – RGB Picture
- Left Creates New Class of Victims, Illegal Aliens, While Real …
- mental_floss Blog » Amazing Color Photos from WWI
- VE Day, Moscow Style : Lawyers, Guns & Money
เรื่องที่เกี่ยวข้อง