Grid not getting rows when the filter is blank

I’ve a numeric column postal code and there is a text field to search for it. When there is no matching, it returns blank grid which is fine. But when the textfield is emptied, the grid is still blank, not getting the data from DB. I think there should be another query to get all rows but I don’t know how to let the grid know.

Here is the code which does the filter private Consumer<Integer> numberConsumer(String columnName) { Consumer<Integer> consumer = number -> grid.setItems(query -> { write("Number :" + number); return customerEntityService.list(PageRequest.of(query.getPage(), query.getPageSize()), (root, query1, criteriaBuilder) -> criteriaBuilder.equal(root.get(columnName), number) ).stream(); } ); return consumer; }

image.png
image.png

Any help please ?

I fixed it. It is because the text field is getting a null value and the current query looks for equal which is why the grid is still blank

Here is the updated code which fixed the issue

log.atInfo().setMessage("Creating consumer for column {} with value {}").addArgument(columnName)
                            .addArgument(number).log();
                    return number != null ?

                            customerEntityService.list(PageRequest.of(query.getPage(), query.getPageSize()), (root, query1, criteriaBuilder) ->
                                    criteriaBuilder.equal(root.get(columnName), number)
                            ).stream()
                            :
                            customerEntityService.list(PageRequest.of(query.getPage(), query.getPageSize())).stream();

Here you can see, I check whether the value is null and if so, use findAlll ( here I named it as list ) method