V
V
Valeriy_Morozov2022-01-28 05:06:25
Java
Valeriy_Morozov, 2022-01-28 05:06:25

Code example: filtered table using Thymeleaf and Spring (can be Boot), how to find?

I really want to study someone else's code for learning purposes. any filtering is needed, except for the Search bar, everywhere I find filtering only through it.
And I would really like to look at a table where there is sorting (a simple click on the table header or the like) and filtering (for example, buttons, a drop-down list, checkboxes, whatever).
Here is something like this:
ZWiKYX8.png

At least in the most minimal implementation, I can’t find it on github, I’ve been sitting full time for the second day.
Please advise, I would be extremely grateful for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2022-01-28
Hasanly @azerphoenix

Good afternoon.
Well, here you should pay attention to 2 implementation options:
1) filtering / sorting on the client side using js. Those. data is sent from the server, and then this data is sorted on the client side
2) filtering / sorting on the server side. And the data is already given in a sorted form
. Sorting and filtering on the client side can be achieved using js.
Here is the finished product:
Data Tables -
sorting - https://datatables.net/examples/basic_init/table_s...
filtering - https://datatables.net/extensions/fixedheader/exam...
If you need server-side filtering and sorting in DataTables, then:
https://datatables.net/examples/data_sources/serve...
And here is a ready-made lib for Spring to work with DataTables. Filtering is also supported:
https://github.com/darrachequesne/spring-data-jpa-...
Here is a custom js sorting example

simple click on the table header

https://bootsnipp.com/snippets/1erEV
Now, regarding filtering and sorting on the server side using Spring itself:
https://www.bezkoder.com/spring-boot-pagination-so...
https://www .baeldung.com/spring-data-jpa-paginatio...
PS developer bezkoder (link above) also has a page on github where project sources are offered

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question