In Wicket-Examples, Repeaters, there's an example of a DataTable from
Wicket-Extensions.  The data provider supplies lists of javabeans, each
bean representing a row in the table.  The PropertyColumn object for
each column of the table gives information about the column title, its
sortability, and the non-OGNL string used for pulling a cell's data out
of the bean.

In this example, the column names are hardcoded as bean properties, but
what I want is to display any arbitrary JDBC ResultSet in a DataTable.
Has anyone written code to do that?  (And if so, could I see it?
ASP.NET has this feature, and I'm rewriting code that uses it.)

If not, I was thinking that I could implement IDataProvider to contain
information about the number and names of the columns taken from the
ResultSetMetaData.  

The data provider would hold a list of row objects, each of which would
be (or contain) an indexed sequence (an Array or ArrayList) of atomic
data objects, obtained by calling "resultSet.getObject(index)" varying
"index" within the column count.

My subclass of DataTable would be constructed with this data provider as
an argument.  A loop (indexed within the column count) would create a
list of PropertyColumn objects -- each with the display model based on
the column name recorded from the ResultSetMetaData, and a non-OGNL
property expression that makes use of List/Array indexing to access the
specific field in the row.

Does this sound like a good approach, or am I re-inventing the wheel
here?


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to