Column header sort

101 views
Skip to first unread message

naveen

unread,
Mar 2, 2011, 8:29:12 AM3/2/11
to Grails Startup Support Group
Hi Team,

Am very new to groovy and grails, I Am facing a problem. Kindly help
me to get rid of this problem.


The basic functionality of any new technology is to have sorting on
click of table's column header.
And am sure that this functionality is in Grails too.

Am using the grails tag <g:sortableColumn> tag to have a column header
sortable.But still when i click the header it doesn't sort the data.
However, on click of the header the URL has the params like
".../sort=books.name&order=asc" and the table gets refreshed, but it
doesn't actually sorts the content.

Is that i have to do something in controller? If so, can anybody
please post the working sample code or steps to make this work.

Am bit confused! :(

Any help will be great for me.

Kind regards
Naveen

Jason Stell

unread,
Mar 2, 2011, 8:59:49 AM3/2/11
to grails-startup...@googlegroups.com, naveen
Your controller action must handle the sort parameters. Generally, you can just pass the parameters to the list() method of the domain class, e.g., 

class BookController {
  def list = {
     [books: Book.list(params)]
  }

}

BTW: you may want to post questions like this to the Grails user mailing list. The subscribe info is here: http://www.grails.org/Mailing+lists

Regards
Jason




--
You received this message because you are subscribed to the Google Groups "Grails Startup Support Group" group.
To post to this group, send email to grails-startup...@googlegroups.com.
To unsubscribe from this group, send email to grails-startup-suppo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/grails-startup-support-group?hl=en.


Warner Onstine

unread,
Mar 2, 2011, 9:06:52 AM3/2/11
to grails-startup...@googlegroups.com
Thanks Jason! I was going to suggest just that. While this is a great
resource for Grails questions, would like to save it for the tougher
questions :-) (not to mention questions about using Grails in a
startup and what that entails).

Where's the dividing line? I'll let the overall community decide that,
but I want this list to be helpful to everyone using Grails at a
startup!

-warner

Reply all
Reply to author
Forward
0 new messages