DataGrid - getSelected, getCurrentPage and getAll - please advise

Hello,
I want to generate a report from a DataGrid. Like the Excel builtin action/button: Seleted, Current page or All.

image

I using v1.5.5.

To get selected rows, it easy.
But how to get all rows on current page?
And how to get all rows from all pages (a filter is aplied so it is not a SELECT * FROM ATABLE…)?

And BTW, how to do “Select All rows” on the GUI / DataGrid? Is it possible? And with a shortcut?

Thank you very much in advance.

NOTE: I tried Excel or JSON technique, but failed:

Tomas

The link above are for Flow UI. That is wrong.
This is better.

But anyway, Json Exporter does not have ALL exporter. And AllExporter for Excel is so confusing…

OK, I was able to do it like this.
I was not able to get all rows.
I so I made my own new query.
The bad thing is, that it does not respect the UI Filters…

 private Collection<Object> getItemsForReport(ExportMode exportMode) {
        if (exportMode == ExportMode.ALL_ROWS) {
            List<ApplicationForm> afs = dataManager.load(ApplicationForm.class)
                    .query("select a from ApplicationForm a where a.espApplicationStatus = :espApplicationStatus1")
                    .parameter("espApplicationStatus1", status.getId())
                    .list();
            return new ArrayList<>(afs);
        } else {
            return ExportMode.CURRENT_PAGE == exportMode
                    ? applicationFormsStatusTable.getItems().getItems().collect(Collectors.toList())
                    : new ArrayList<>(applicationFormsStatusTable.getSelected());
        }
    }

If you create a variable for the ApplicationForm data loader, then you can set the data loader at a relevant time and run the following code

private CollectionLoader<CustomMaterial> dataLoader;

private Collection<Object> getItemsForReport(ExportMode exportMode) {

    List<ApplicationForm> afs = dataManager
                .load(ApplicationForm.class)
                .query(dataLoader.getQuery())
                .condition(dataLoader.getCondition())
                .list();

       ....
}

It will run the same query that gets run for the filters, but without the “limit” restriction that is applied using pagination

It works. Wonderful! Than you!