Sending parameter when calling dialog that shows list

In my flowUI application, when I am calling an editor screen, I can pass any parameter which is a field of the editor screen as discussed in one of my posts here. However, this is only limited to the fields of the editor view

In a different example below, when I click of the button marked 1, I am showing a dialog to display a list of employees, here is my code:

@Subscribe("selectEmployeeBtn")
    public void onSelectEmployeeBtnClick(ClickEvent<Button> event) {

        DialogWindow<View<?>> window =
            dialogWindows.lookup(this, EmployeeProfile.class)
            .withSelectHandler(selectedItems -> {
                    for(EmployeeProfile employeeProfile : selectedItems){
                        AttendLogManualLine line = dataContext.create(AttendLogManualLine.class);
                        line.setEmployeeProfile(employeeProfile);
                        line.setAttendLogManual(getEditedEntity());
                        attendLogManualLineDc.getMutableItems().add(line);
                    }
                })
                .build();
        
        window.open();

    }

This works well.

image

Now I want to filter the list of employees with the company selected (marked 2 in the screen-shot above).

How can we achieve this option? Can send the company as a parameter or how can we get the employeesDl from where I am opening the dialog?

You can pass Company as a parameter in the same way as you did in the topic you mentioned:

DialogWindow<EmployeeProfileListView> window = dialogWindows...build();

EmployeeProfileListView view = window.getView();
view.setCompany(company);

window.open();

Thanks Konstantin. But I might have been missing something, it’s not working.

If I use the code-snippet, it looks like as follows ,

          DialogWindow<EmployeeProfileListView> window1 = dialogWindows.lookup(this, EmployeeProfile.class)
                    .withSelectHandler(departments -> {
                        // ...
                    })
                    .build();

But it shows some error and suggests as follows:

image

If I make the code like the one below as suggested by the IDE, that error goes away but as you see Company is not recognized since it’s a list view.

image

You should specify your view class:

DialogWindow<EmployeeProfileListView> window1 = dialogWindows.lookup(this, EmployeeProfile.class)
          .withViewClass(EmployeeProfileListView.class)
          .withSelectHandler(departments -> {
              // ...
          })
          .build();

Thanks, I followed exactly as you see below, I can’t set Company to pass it to the ListView to load data filtered by Company. It used to work in the CUBA platform but I don’t see it working or you may have implemented this same functionality in a different way (see setCompany is red).
image

You should add the setCompany() method to the EmployeeProfileListView class.

Thank you so much Konstantin.