I'm using a custom ListView to generate a table.  The content of the
table consists of four columns of data.  I have that working just
fine.  But I'd like to add an additional table row on occation to
"group" rows of data in the table.  Thus, there would be a groupRow
that specifies a date, then many availRows of data for that date, then
another groupRow, more availRows, and so forth.

Here is some example HTML.  I know that this HTML and code will not
work the way it is now -- it is just meant to illustrate.  The first
TR should only be displayed when the date changes.  Otherwise, only
the second TR should display in each populateItem.

        <table>
                <tr wicket:id="groupRow">
                        <td colspan="4" wicket:id="date"></td>
                </tr>           
                <tr wicket:id="availRow">
                        <td wicket:id="lastName"></td>
                        <td wicket:id="firstName"></td>
                        <td wicket:id="startTime"></td>
                        <td wicket:id="endTime"></td>
                </tr>
        </table>

Here is the custom ListView's populateItem:


        protected void populateItem(final ListItem item) {
            SimpleDateFormat dateDateFormat = new SimpleDateFormat("M/d/yyyy");
            SimpleDateFormat timeDateFormat = new SimpleDateFormat("h:mma");
            ReportRow rr = (ReportRow) item.getModelObject();
            Date update = getStartDate(rr.getStartTime());
            if (current == null || current.getTime() < update.getTime()) {
                current = update;
                item.add(new
Label("date",dateDateFormat.format(rr.getStartTime())));
            }
            else {
                    item.add(new Label("lastName",rr.getLastName()));
                    item.add(new Label("firstName",rr.getFirstName()));
                    item.add(new
Label("startTime",timeDateFormat.format(rr.getStartTime())));
                    item.add(new
Label("endTime",timeDateFormat.format(rr.getEndTime())));
            }
        }

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to