I'm trying to do a controller that do the Server Side for DataTables.
@RequestMapping(value="/grid", method={RequestMethod.GET}, produces= MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public DataTablesResponse<MyObject> grid(DataTablesRequest dt) {
return service.getListOfMyObjects();
}
DataTablesRequest.class:
public class DataTablesRequest {
private int draw;
private int start;
private int length;
private Search search;
private List<Order> order;
private List<Column> columns;
//... Getters and setters
}
Order.class:
public class Order {
private String column;
private String dir;
//...getters and setters
}
Column.class
public class Column {
private String data;
private String name;
private boolean searchable;
private boolean orderable;
private Search search;
//...Getters and setters
}
Search.class:
public class Search {
private String value;
private boolean regex;
//...getters and setters
}
The problem is that DataTables sends parameters like: column[0][name] and SpringMVC is expecting something like column[0].name.
Is there any way to fix that? How can i bind the parameters of the DataTables to an object?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With