Browse screen filters with load delegate

Quick question for the Cuba gurus…

Does a browse screen load delegate affect the browse filter results? I only ask because I’ve got a screen that loads the browse screen based off of certain criteria, and after doing so, the filters don’t seem to work. I’ll look into it more in-depth, but just wanted to know if this is a known issue.

The controller code:

@Subscribe
    public void onInit(InitEvent event) {
        for (String role : userSession.getRoles()) {
            if (role.equals("viewAllErrors")) {
                canSeeAll = true;
                break;
            }
        }
    }

    @Install(to = "errorLogsDl", target = Target.DATA_LOADER)
    private List<ErrorLog> errorLogsDlLoadDelegate(LoadContext<ErrorLog> loadContext) {
        if (canSeeAll) {
            return dataManager.load(ErrorLog.class)
                    .query("select e from hermes_ErrorLog e order by e.dateOfError desc")
                    .view("errorLog-view")
                    .list();
        } else {
            return dataManager.load(ErrorLog.class)
                    .query("select e from hermes_ErrorLog e where e.whoMade = :whoMade or e.createdBy = :createdBy order by e.dateOfError desc")
                    .parameter("whoMade", userSession.getCurrentOrSubstitutedUser())
                    .parameter("createdBy", userSession.getCurrentOrSubstitutedUser().getLogin())
                    .view("errorLog-view")
                    .list();
        }
    }

Filtering by an Enum (Yes/No) field on the browse screen doesn’t seem to work. I’ll keep working on it, but if it’s a known issue, it would help me to stop looking for the problem.

It should be noted that I was logged in as a Substituted User while doing do, as my user would not show any results.

Thanks!
Adam

Hi,
The filtering in CUBA is done on the data loading level, not in UI component.

If you define dataLoader delegate, then you are responsible for filtering, sorting and paging.
Filter conditions are passed to the delegate method in the loadContext method and can be extracted with the code loadContext.getQuery().getCondition().

1 Like