Dandelion-Datatables v0.8.11 has been released in Maven Central.
This new version really looks like a major version but we reserved the release of the v0.9.0 for the connection between Dandelion-Datatables and Dandelion.
Well, let’s see some changes.
#### Core
First of all, we really moved forward regarding the stability of the framework. Indeed, we added lots of unit and integration tests. I’ll soon write another blog to explain how tests are written in the particular case of a framework.
We also refactored the way callbacks are added because some conflicts were added using e.g. an AJAX-enabled table (where the fnAdjustColumnSizing(true)
function is automatically called in a fnInitComplete
) with a manual callback (e.g. the <datatables:callback>
tag or the dt:cbk:init
attribute. Well, to be short, no more conflict… :-)
#### JSP implementation
Some enhancements have been added in the JSP implementation.
One of them is for example the row index that is now available inside the <datatables:table>
tag. You need to use the row
table attribute and append _rowIndex
as follows :
<datatables:table id="myTableId" data="${persons}" row="person"> <datatables:column title="Id" property="id" /> <datatables:column title="FirstName" property="firstName" /> <datatables:column title="LastName" property="lastName" /> <datatables:column title="City" property="address.town.name" /> <datatables:column title="Mail"> <c:out value="${person_rowIndex}" /> </datatables:column> </datatables:table>
Another one is the support for MessageFormat pattern. You can now use both the property
and the format
attributes to format columns as you need. Note that this formatting only apply on table that use DOM sources.
<datatables:table id="myTableId" data="${persons}"> <datatables:column title="Id" property="id" /> <datatables:column title="FirstName" property="firstName" /> <datatables:column title="LastName" property="lastName" /> <datatables:column title="City" property="address.town.name" /> <datatables:column title="Mail" property="mail" format="<a href=''mailto:{0}''>{0}</a>" /> <datatables:column title="Date of birth" property="birthdate" format="{0,date,dd-MM-yyyy}" /> </datatables:table>
#### Thymeleaf implementation
One the most significant change is that almost all attributes of the DataTables’ dialect are now evaluated using the Standard Thymeleaf expressions. As a consequence, you have to wrap those attributes’ value with single quotes. Here is an example :
<table id="myTableId" dt:table="true" dt:url="'/persons'"> <thead> <tr> <th dt:property="'id'">Id</th> <th dt:property="'firstName'">Firstname</th> <th dt:property="'lastName'">Lastname</th> <th dt:property="'address.town.name'">City</th> <th dt:property="'mail'">Mail</th> </tr> </thead> </table>
However, in order to keep the dialect as simple as possible, you can still use plain text (that won’t be evaluated) in some attributes (dt:theme="bootstrap2"
, dt:sortinit="asc"
, …). Thanks to Pavel Janecka for his new contributions in this new feature.
#### Documentation
Of course all the documentation has been updated.
Please note that we also added a new column in all tag references, to indicate the compatibility of the feature with the type of data source you use.
As usual, you can see the full changelog here and as usual, your thoughts and feedback are very welcome. :-)