Server side pagination, submitting the form data

Server side pagination, submitting the form data

rohit2592rohit2592 Posts: 1Questions: 1Answers: 0
edited April 2016 in Free community support

Hi,

I am new to generating the data tables and working with server side processing, i went through the documentation but could dig in enough to have a working copy. What i have is a data table which has fairly large number of records returned and i wanted to do server side pagination on it. I have 7 search fields on the screen and i am using a HTML form element to capture user input. I have a search button on the screen which on click generates the data table bringing back the results from the database. This button is pretty much the submit button and hence i had form submit action linked to it, My question is how can i post form data and capture it in a DTO in the controller?. I am attaching some code which i have to be more clear

"ajax":{
"url": "/users/search"+queryString,
"type": "POST",
"dataSrc": function(jsonResponse){
return jsonResponse.data;
}
},

this is my ajax calla and i want to send form data instead of passing the user input in the query string ["/users/search"+queryString]

controller:

@RequestMapping( value = "/page/search" , method = RequestMethod.POST )
public @ResponseBody JsonResponse <List<PageDetailsOutputFormDto>> getPageDetails(@Valid PageDetailsFormDto pageDetailsFormDto, BindingResult result)

JSP: Form Element:
<form:form action="${pageContext.request.contextPath}/page/search" id="page-search-form" name="page-search-form" method="POST" modelAttribute="pageDetailsFormDto">

I want to capture the form data passed in from the ajax call in the controller. I will add draw, length and start parameters to it later, but will this approach work? can form data be posed via ajax call when trying to implement server side pagination?

Please help.

-Thanks in advance.

This discussion has been closed.