I'm developing an adminstration interface for a set of tables. I need to implement functionalities such as listing, sorting, filtering and pagination.
I'm using Spring Boot as a starter and Spring Data Jpa for repository. I've searched the Web for some examples about a complete solution that includes all the above functionalities. What I found included almost all of them, but appearently if there was pagination and sorting there wasn't filtering or viceversa.
Now I'm storing the filter in a application object on session using @ModelAttribute
but I know that is now a good design because the applciation will extend and it becomes hard to maintain. I'm also using Page
and Pagination
for pagination purpose and using Specifications
for filtering.
What I want is to submit all the data, i.e.: search fields, sorted fields and current page, in a single request. Off course if the search fields are not empty the pagination will be reinitialize.
Another thing is that I don't want to use jQuery datatables but plain HTML and form submission.
Here are some tutorials and examples that I found:
Thanks in advance
EDIT html form included
Here is the structure of my table and my pagination section:
<form method=post action=someLink>
<table> -populated from controller using Thymeleaf - </table>
<div class=pagination>
<ul> - actually this div is build using the page object returned from server -
<li><a href=link/?page=;size=;>1</a></li>
<li><a href=link/?page=;size=;>2</a></li>
<li><a href=link/?page=;size=;>3</a></li>
</ul>
</div>
</form>
As you can see the form is separated from my pagination div. When I click on a page number a get request is send to the server and executes the query with the stored filter. When I submit the form the page number is not taken into consideration because the number of pages can change.
So my question is how to build the form to include the pagination in one single submit.
I'm thinking instead of using a's to use input elements so on the server I can read the data from them. I don't know how to submit that post request with the pageable attributes.
Thanks