Hi there:
I have a an external web API which returns a Page
@GetMapping(“/paged”)
public Page getpagedplotinformationview(Pageable pageable)
{
return _plotinformationview_repository.findAll(pageable);
}
Postman shows that the method works okay. Now…I have a frontend application that uses Vaadim grid to show the data. The unpaged data is retrieved without an issue, the problem is when I want to use the above method in the client side using the code below:
public List Pagedlist(Pageable pageable) {
return webClient.get()
.uri(uriBuilder → uriBuilder
.path(“api/paged”)
.build())
.accept(MediaType.APPLICATION_JSON)
.retrieve()
.toEntityList(plotinformationview.class)
.block().getBody();
The java class for the UI grid tries to populate the grid by calling the controller method as below:
grid.setItems(query → _plotinformationviewservices.Pagedlist(VaadinSpringDataHelpers.toSpringPageRequest(query)).stream())
I also tried
grid.setItemsPageable(query → _plotinformationviewservices.Pagedlist(query));
when I run the application, the debugger doesn’t throw any error and the browser Developer tools shows that the the WEB API is hit and returns a 200 HTTP response, however instead of appearing all the data in the vaadim grid the only thing that appears is a zero (0).
Obviously, I’m not doing something right but I don’t know what it is, the Pageable in the web api has default values in case that the pagesize and pagenumber parameters aren’t provided . I run the test in postman and yes…there is always data returned even if the query parameters aren’t provided by the frontend.
I read numerous articles about dataprovider and callbacks but I’m failing to understand as I haven’t come across with one simple example.
Any assistance will be gratly appreciated
Thanking you in advance.
Regards
Jose