Hi guys again. hehe So, I did create a class MaterialGridDataSource that implements GridDataSource and I put as my source in the Grid.
But, for I to do my comparisons, I need to know the label of the column that was "clicked". How I do it? Thank you! 2012/8/10 William Lopes <williamlopes....@gmail.com> > @Pavel > Thanks, I think that now I did understand. > > I go create a prepare method for my class Material, and it I will > implement the comparable (following the same default), ok? > > @Thiago > I want implement a ordination (normal, common like the existing) of the > rows by column (additional). > > 2012/8/10 Pavel Vodenski <pa...@beckon.com> > >> Here's Tapestry's implementation of GridDataSource for Collections: >> >> https://github.com/apache/tapestry-5/blob/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/grid/CollectionGridDataSource.java >> >> That implementation works with any class, but you can write a special one >> that works with just Material instances. In your implementation of the >> prepare >> method< >> https://github.com/apache/tapestry-5/blob/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/grid/CollectionGridDataSource.java#L44 >> >, >> you can do whatever special sorting you want to do, based on your Material >> instance and anything else you'd like to consult. You can also create a >> new >> one-off class just for the rows of your Grid--a class that wraps a >> Material, ValorAtributo, and Atributo tuple, for example. You'll probably >> need to create a complex Comparator that wraps the one based on the >> PropertyConduits associated with incoming SortConstraints--it depends on >> whether you want to augment the existing sorts that available or replace >> them completely. If you do need a complex ordering, Google's Guava library >> has an Ordering class as well as ComparisonChain both of which are >> well-suited for rich Comparators. >> >> Best of luck, >> - P >> >