/DataTablesSpringBootDemo

Server-side mode for a DataTables page using Spring Boot

Primary LanguageJavaMIT LicenseMIT

DataTablesSpringBootDemo

See this overview for more information.

Before anyone gets too excited, this is just me messing around.

This solution:

It does, however, include basic logic to make the filtering tolerant of diacritics and uppercase/lowercase - so that a search for any of Motörhead, motörhead, Motorhead, or motorhead will find any of the other variants.

It does not handle:

  • column-specific searching
  • global searching with regexes

It does handle multi-column sorting.

If you want to use the DataTables Search Builder, then be aware of how it creates its own additional query parameters - the same as you get by executing searchBuilder.getDetails().


If I were going to refactor this to reduce the burden of always using demoRepository.findAll(), I would build a dynamically constructed JDBC prepared statement, executed via Spring's JdbcTemplate. In my case, because my demo uses MySQL, I would consider using its LIMIT and OFFSET clauses. But I would be aware that other databases may have different syntax for these (or maybe even no syntax at all).

See also Another Spring Boot Demo for DataTables Server-Side Processing, which is one such approach.