Minimal Dandelion Datatables Spring Boot Configuration

I blogged about using Dandelion as a Web Application Asset Manager before. That was back in NixMash Spring v0.1.5. Dandelion was removed in v0.1.6 but not forgotten. Now in v0.2.9 we're adding an Administration Module to NixMash Spring (based on Gentelella) and starting, as all Administration Modules do, with User Management.

Isn't that a pretty table? It's Dandelion Datatables and it's a functionally awesome table. We could have gone with Dandelion Core and the full Asset Management suite with its bundles and webjars, but I wanted to see how few modifications would be required to use only Dandelion Datatables with Thymeleaf in Spring Boot. As you'll see, adding Datatables alone can be a simple matter.

We begin in build.gradle where we'll add the Dandelion datatables-thymeleaf dependency.

We will need to add a DandelionConfig class, just like when we used Dandelion Core. As a sidebar, we removed the ThymeleafConfig class when we went with the Spring standard Thymeleaf template configuration recently. I'm mentioning that because we previously added our DandelionDialect Bean in our SpringTemplateEngine configuration Bean with


but Spring Boot takes care of recognizing the Dandelion Dialect for us. So no ThymeleafConfig required.


Here's the cool part. Dandelion and Thymeleaf together resulting in a rich data table with minimal coding.

A couple of things I wanted to point out. (1) The inclusion of the “dt” dandelion namespace and URI. (2) Denoting the table as a Dandelion table with dt:table=”true”. We can set the full range of “dt” properties if we wanted to, of course. One of those properties is Theme, but for the “table table-striped” classes we simply let our Bootstrap3 theme handle things.

Source Code Notes for this Post

All source code discussed in this post can be found in my NixMash Spring GitHub repo and viewed online here.

Posted April 08, 2016 11:08 AM EDT

More Like This Post