Rakesh,
Nice to see that this functionality is already used. Especially the
AJAX variant seems very interesting to me. I'm curious, how are you
using this? Some web application that asynchronously refreshes its
table data?
I had thought about adding ID's and CSS classes to the generated HTML
table. I decided against it because there are many things that users
may expect from such tables that I cannot foresee. For instance with
CSS: alternating row classes, making the left-most column bold, etc
etc. With ID's: How can I make ID's unique across several tables? So I
thought it would be better if users just wrapped jOOQ-generated tables
in a dedicated div like this:
<div class="jooq-table">
<table>...</table>
</div>
And then apply some styling "externally", like this:
/* header style */
.jooq-table thead th { }
/* style of odd rows */
.jooq-table tbody tr:nth-child(odd) td { }
/* style of even rows */
.jooq-table tbody tr:nth-child(even) td { }
As far as ID's are concerned, you have two options. You can either
XSL-transform the HTML table and add ID's (and classes) using XSL
stylesheets in Java or in JavaScript, or you can access rows/columns
easily using jQuery:
// Access the fourth column header
$('.jooq-table th[3]')
// Access row 4 column 4
$('.jooq-table tbody tr[3] td[3]')
What do you think about this?
Cheers
Lukas
PS: Please note, I'm planning to support Wicket and Play! integrations
for jOOQ in the near future. There will be quite a few ready-to-use
components around this topic, then, I hope.
2011/7/25 Rakesh Waghela <[email protected]>:
> It is good to see that you have provided useful helper methods with result.
> to generate HTML,JSON.XML etc..
> I am already getting good Table headings with Model.MODEL.ID.as("Good
> Title") in my select queries.
>
> result.formatHTML() will be more useful if you can give the options to set
> ID and CLASS attribute values.
> like..
> result.formatHTML(String idValue,String classValue);
>
> if values specified then generate HTML with it or else.. usual way ! :)
> This will help in table styling at it's origin and for quick use as ajax
> response without additional processing at service/controller layer.