0

I use jQuery DataTable and read this page

I can Use "serverSide": true, for pagination, sort and etc. on server side. But I do not udrestand how worck it. I thing that DataTable sent parameters to server, for example

draw - Type:integer
The draw counter that this object is a response to - from the draw parameter sent as part of the data request. Note that it is strongly recommended for security reasons that you cast this parameter to an integer, rather than simply echoing back to the client what it sent in the draw parameter, in order to prevent Cross Site Scripting (XSS) attacks.

I add to my controllers method this variable

@RequestParam(value = "draw", required = false) Integer draw

But I get null value. Then the table itself does not transmit these values and I have to send them to mymself?

How do it?

I want create pagination on server side but I not see examples for spring

1 Answer 1

0

I wrote that library a while ago:

Example:

@RestController
public class UserRestController {

    @Autowired
    private UserRepository userRepository;

    @JsonView(DataTablesOutput.View.class)
    @RequestMapping(value = "/data/users", method = RequestMethod.GET)
    public DataTablesOutput<User> getUsers(@Valid DataTablesInput input) {
        return userRepository.findAll(input);
    }
}

Maven artifact:

<dependency>
     <groupId>com.github.darrachequesne</groupId>
     <artifactId>spring-data-jpa-datatables</artifactId>
     <version>3.0</version>
</dependency>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.