 |
Learn by Teaching: Examples using the Tapestry Table component
Posted by johnreynolds on October 06, 2004 at 11:53 AM | Comments (13)
There's an old saying that the best way to learn something is to teach it.
I've been evaluating the Tapestry Web Component Framework for a new project, and I really needed to learn how to use Tapestry's multi-page sortable table.
What better way then to create an example application to share with others what I have learned?
If you've got an itch to learn a bit about how to use Tapestry's Table component, please download TapestryTables.war and try it out. I have tested this application with Tomcat 5.0, but I think it should work with any standard servlet container.
I've been exposed to Tapestry before, and I am quite fond of it, but I had never used the Table component. This particular component is very powerful and very flexible... good attributes when you need to use the component, but sometimes a source of confusion when you're first learning how to use it.
Tapestry is well documented, and examples for using the Table component are included in the distribution, but at first I couldn't quite figure out how to do what I wanted.
Happily, after a bit of judicious lurking on the Tapestry Users List I was able to figure out how to do what I needed to do.
There are some really helpful people out on this list, and I'd like to single out Jamie Orchard-Hays in particular. His patient responses in a series of exchanges with Lindsay Steele really set me on the right track.
I am delighted with the movement towards Web Component Frameworks for developing browser-based applications. With Tapestry, Echo, and now JSF it won't be long before the days of tedious JSP tags, JavaScript libraries and custom handlers pass into the mists of memories.
A critical element necessary for these open source frameworks to really take off is the wide availability of examples for the various components. A lot of really talented folks have developed some great components, but they sometimes need help in documenting and demonstrating their creations.
If you do have a chance to check out my examples, please let me know how I can improve them, and by all means feel free to pass them on and expand them. Hopefully, TapestryTables.war is just the first installment in a series.
Update: Oct. 6th, 2004 - I've updated TapestryTables.war to incorporate suggestions and add some examples of Editable tables.
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
Table component is really great, and I'm using it extensively in my Tapestry web app, but I have just 2 minor issues. It would be really great if column String definition wouldn't perform OGNL expression on table row object, but instead on container page/component and it would also require to specify iterated row object, thus presented value could easily be result of some calculation on current row object.
Almost same as Foreach component inject current iterated value into page/component, and inside loop one can call some OGNL expression that would do some logic on that current value.
And second thing is that TablePages component seems a bit unattractive, and didn't figure out way to easily replace it with something better. Burden is also that it has to be contained inside generated tag, and not somewhere else on the page if desired.
Posted by: vjeran on October 01, 2004 at 09:02 AM
-
Thanks a lot!!
I
Posted by: enricod on October 06, 2004 at 02:51 AM
-
Update: Yet another update. Enjoy.
Posted by: johnreynolds on October 11, 2004 at 11:25 AM
-
hi,
learnt about ur component from howard's page here http://howardlewisship.com/blog/2004/10/using-tapestrys-table-component.html
well done and looking forward to ur subsequent tutorials. mayb i'll b 'free' enough 2 emulate u soon. Amen.
Posted by: bioye on October 18, 2004 at 07:46 AM
-
what about adding searching to the functitonality? so i can search the whole table for a string or even limit the search to a set of columns or rows (is that overambitious?) this is useful when you are a looking for a field on a table with many pages (17 in this case). What do u think?
Posted by: bioye on October 18, 2004 at 08:42 AM
-
Searching: Doesn't sound overambitious.... You'd search the datasource to determine the row that matches and position the table to a page where the row will be visible. Highlighting the row might be a trick.... perhaps a hack of the evenOdd bean to specify a different CSS style when search conditions are met.
Fun!
Posted by: johnreynolds on October 18, 2004 at 11:48 AM
-
Tapestry Tree Examples
I have just posted the first installement of TapestryTrees.war. As with TapestryTables.war, this has been tested with Tomcat.
Enjoy!
Posted by: johnreynolds on October 22, 2004 at 01:25 PM
-
John, thanks for the kind words and I am very glad to have been helpful!
Jamie Orchard-Hays
Posted by: jamieorc on November 03, 2004 at 05:35 AM
-
Thanks for the awesome tutorials! They have been tremendously helpful. I have created an improvement to your dateComparator if you would like to use it:
public int compare(Object o1, Object o2){
Date d1 = new Date();
Date d2 = new Date();
String DATETIME_FORMAT = "MM/dd/yyyy";
java.text.SimpleDateFormat sdf_datetime = new java.text.SimpleDateFormat(DATETIME_FORMAT);
try{
d1 = sdf_datetime.parse(o1.toString());
d2 = sdf_datetime.parse(o2.toString());
}catch(Exception e){
e.printStackTrace();
}
return d1.compareTo(d2);
}
Reply from John:Thanks for the contribution. I need to redo this example when Tapestry 4 is officially released, and I will gladly use your code.
Posted by: jaemmer on July 06, 2005 at 10:41 AM
-
Hi ! I was taking a look at your examples and they are really great. I was wondering why is it that you chose to implement Editable Columns and not Editable Rows. It makes sense to allow single-row Edition...what are your suggestions for doing this ?
Posted by: gbanos on September 26, 2005 at 03:45 PM
-
Hey, your Table examples were great!
One thing i found with the DirectLink example is that LinkedHashMap should be used instead of HashMap for the row data model.
I found that using Hashmap never guaranteed the column header order while LinkedHashMap does.
Posted by: solid on October 13, 2005 at 02:48 PM
-
Hello John,
thanks for publishing examples on using Tapestry Table Component. I still have a bit of work to do in order to make it useful for my project. Namely, I would like to be able to select the row set in the table and perform some Javascript as well as submit actions for processing of the selection (possibly multiple rows) , e.g. some submit buttons on the Form will get enabled or disabled depending on row selection. I am suprised this feature does not come with Table component, as usually manipulation of rows (delete row, update row, drill down to details etc. ) is anticipated. You advice on this matter will be greatly appreciated.
thanks
victor breygin
Posted by: breygin on February 23, 2006 at 10:10 AM
-
Stupid Questions 16: What's the Difference Between Wildcard Generics and no Genericst5
Posted by: 3ufblogg on July 17, 2007 at 02:08 AM
|