diff --git a/README.md b/README.md index 7b17116..2d5234d 100644 --- a/README.md +++ b/README.md @@ -667,7 +667,37 @@ $(document).ready(function() { data : 'status' }] }); -} +}); +``` + +With the [`searchPanes.cascadePanes`](https://datatables.net/reference/feature/searchPanes.cascadePanes) feature: + +```js +$(document).ready(function() { + var table = $('table#sample').DataTable({ + ajax : '/data/users', + serverSide: true, + dom: 'Pfrtip', + columns : [{ + data : 'id' + }, { + data : 'mail' + }, { + data : 'position', + searchPanes: { + show: true, + } + }, { + data : 'status', + searchPanes: { + show: true, + } + }], + searchPanes: { + cascadePanes: true, + }, + }); +}); ``` Regarding the deserialization issue detailed [above](#step-6---fix-the-serialization--deserialization-of-the-query-parameters), here is the compatibility matrix: diff --git a/src/main/java/org/springframework/data/jpa/datatables/repository/DataTablesRepositoryImpl.java b/src/main/java/org/springframework/data/jpa/datatables/repository/DataTablesRepositoryImpl.java index 0c955d9..b1bb1dc 100644 --- a/src/main/java/org/springframework/data/jpa/datatables/repository/DataTablesRepositoryImpl.java +++ b/src/main/java/org/springframework/data/jpa/datatables/repository/DataTablesRepositoryImpl.java @@ -118,6 +118,9 @@ private SearchPanes computeSearchPanes(DataTablesInput input, Specification s this.entityManager.createQuery(query).getResultList().forEach(objects -> { String value = String.valueOf(objects[0]); long count = (long) objects[1]; + // FIXME the number of items after filtering is the same as the total number of items, so the 'searchPanes.viewTotal' + // feature will not work properly. Fixing this would require two distinct queries, one with filtering and the other + // without. Reference: https://datatables.net/reference/feature/searchPanes.viewTotal items.add(new SearchPanes.Item(value, value, count, count)); });