Tuesday, January 29, 2008

Ok, so you need to create a multi row data table right? Now you want to do this with JSF and you see that you're up a creek without a paddle. This doesnt fit the norm for most "grid" layouts on the web. The standard JSF just doesnt allow for this with a datatable but you can use the panelgrid to get the results that you want. Here is how.



Why don't we break this down to see what we do here.

Line 1 is our standard data table layout using the backing bean reportListingReports.claimsToWork

There is nothing new here, standard call to a backing bean for the JSF information. We set the variable ctwb for use in the column.

Line 5 is where we introduce the column. As you can see here the matching tag for this is at line 25. We use one column so we continue to iterate through our row data.

Line 6 introduces our panel grid. We use this to construct the real table here. We continue to go down through the panelgrid and output the different elements using the ctwb variable.

Line 22 closes out the panelgrid.

Line 23 gives us a summary row underneath. I use this for outputting a status message on the previous row but you could introduce another panelgrid or whatever you like here.

So to summarize what we have here is 2 visible rows of data on the screen. Presentation goes something like this.

ROW1COL1 ROW1OL2 ROW1COL3
ROW2BUT BUT IS PART OF DATA ROW 1

ROW2COL1 ROW2OL2 ROW2COL3
ROW3BUT BUT IS PART OF DATA ROW 2


You should have the idea. This gives nice formatting for anyone that needs to output a text description on the row but doesnt have the space on the screen (or in the data table column.

Now, remember you'll need to use the column classes and style the table correctly or this may not look just right for you. It is easy enough to acomplish with some css code.
Comments:
If you also pasted the backing bean code, it would more clear of which datat is shown in which rows....
 
Post a Comment

Links to this post:

Create a Link

<< Home


Recent Posts


Code Syntax Highlighter/Formatter
Why aren't you using Damn Small Linux?
EJB3, Glassfish, MySQL, Toplink Working Together C...
EJB3, Glassfish, MySQL, Toplink Working Together
Google Mapplets and Custom Writeable Pushpins
Well this blog has been fairly inactive since I've...
Starting EJB Certification
Passed SCJP 1.5
SCJP Exam
Test From Brainbench


Archives

01/01/2005 - 02/01/2005
02/01/2006 - 03/01/2006
03/01/2006 - 04/01/2006
04/01/2006 - 05/01/2006
05/01/2006 - 06/01/2006
09/01/2006 - 10/01/2006
10/01/2006 - 11/01/2006
11/01/2006 - 12/01/2006
12/01/2006 - 01/01/2007
04/01/2007 - 05/01/2007
05/01/2007 - 06/01/2007
01/01/2008 - 02/01/2008
02/01/2008 - 03/01/2008
05/01/2008 - 06/01/2008
06/01/2008 - 07/01/2008
08/01/2008 - 09/01/2008
09/01/2008 - 10/01/2008
11/01/2008 - 12/01/2008
12/01/2008 - 01/01/2009
01/01/2009 - 02/01/2009
02/01/2009 - 03/01/2009
04/01/2009 - 05/01/2009
05/01/2009 - 06/01/2009
07/01/2009 - 08/01/2009
01/01/2010 - 02/01/2010

My Software

Blinky - GBPVR Plugin
PhotoCopy - GBPVR Plugin
QTC - Quick Test Case
rBoop - Rob's Timers

Programming Links

C# Formatter
NSIS

Other Links

Damn Small Linux

Sites I Manage

Do it yourself SEO. Cheap.
Pet Supplies
Dog toy of the month club
SqueakerZ pet Deals
Geocaching Community
Hitch hiker Tracking