Closed smsotirov closed 8 months ago
I forgot to add what is in the console:
[Field error in object 'dataTablesInput' on field 'order': rejected value [[]]; codes
[NotEmpty.dataTablesInput.order,NotEmpty.order,NotEmpty.java.util.List,NotEmpty];
Hi! I could indeed reproduce the issue with DataTables v2.0.1.
Columns can now have three ordering states - asc, desc or data index order (specified by an empty string). The columns.orderSequence option has been updated to make use of this, so the third ordering on a column will now take it back to the index order, rather than returning to the first direction.
Reference: https://cdn.datatables.net/2.0.0/
I think removing the @NotEmpty
constraint should be enough, what do you think?
By the first glance over the code, I also think it will be enough. I think the addOrder()
method will handle it.
This should be fixed by https://github.com/darrachequesne/spring-data-jpa-datatables/commit/a214d5bb199fff4ccd578c3bbb71ee64f3a0f198, included in 6.0.2
.
On the latest datatables implementation, when you click on the order headers, there is 3 options. Ascending, descending and none. The spring-data-jpa-datatables plugin works on the first two, but fails on 3rd becasue of the validation in
DataTablesInput
for the field "order" which is@NotEmpty
To reproduse, just click more than twice on the order header on any column. You will see that the arrows toggles to ASC, DESC and the third option is basically none. I this third case, the request looks like this:
No "order" in the request. This causes an error.