The intent of the Grid component is to be quick scaffolding. It can figure out a lot from your data object's class, but it isn't smart enough to understand relationships, just simple types (numbers, Strings, booleans, dates).
When you need more, it's time to provide your own GridModel, rather than let the Grid component figure it out for you: http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/grid/GridModel.html A GridModel is three separate models; the BeanModel defines the properties of the bean, the data model controls how to access the data, and the sort model controls sorting. You often override the data model and sorting model to support letting the database do the sorting, rather than sorting in-memory. Also, a common misconception is that you must use the Grid component; Grid, BeanEditForm and friends are scaffolding; intended for use early in a project, but commonly replaced with something application-custom in a final application. It may be easier to create your own component than it is to bend your data model to conform to Tapestry's components. On Mon, Dec 10, 2012 at 3:21 AM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > Have you tried making Department implement Comparable? Anyway, I think > you'll need to implement your own GridDataSource for that and handle the > sorting yourself. > > > On Mon, 10 Dec 2012 07:49:38 -0200, karans <ske...@gmail.com> wrote: > > public class Employee { >> >> private int id; >> private String employeeName; >> private Department department; >> >> } >> >> public class Department { >> private int id; >> private String departmentName; >> } >> >> >> ----------------------------- >> ListEmployee.java >> @Property >> private Employee employee; >> >> public List< Employee > getEmployees() { >> return session.createCriteria(**Employee.class).list(); >> } >> >> >> ListEmployee.tml >> >> >> <t:grid source="prop:employees" row=”prop:employee”></t:grid> >> >> Department column is not sorting here, can anybody help how apply sorting >> to >> the department column in employee grid. >> >> >> >> >> >> >> -- >> View this message in context: http://tapestry.1045711.n5.** >> nabble.com/How-to-sort-**Association-column-in-Grid-**tp5718569.html<http://tapestry.1045711.n5.nabble.com/How-to-sort-Association-column-in-Grid-tp5718569.html> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> ------------------------------**------------------------------**--------- >> To unsubscribe, e-mail: >> users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org> >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > -- > Thiago H. de Paula Figueiredo > > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org> > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com