Dependent data container query is not being executed


I am using cascading entityComboBoxes in my screen. Let’s consider example of country and states. If I have added changeValueHandler for country combo box and statesDl query contains = :component_countryField or = :container_countriesDc, statesDc will not be refreshed. Removing handler from controller solves the issue.

Is this normal and expected behavior? I believe this was working in Cuba Platform.

What mode is set for the dataLoadCoordinator?

My facets entry

    <dataLoadCoordinator auto="true"/>
    <screenSettings id="settingsFacet" auto="true"/>

It works fine on removing countryField’s onCountryFieldValueChange() event from controller.

Why do you need or = :container_countriesDc in your states query?
Could you provide a test project where your issue is reproduced?

My bad, I wasn’t clear in my question. I meant neither
select e from test_State e where = :container_countriesDc
select e from test_State e where = :component_countryField
query works. I tried and it’s working in test project, I am trying to figure out issue in my project regarding this, everything appears to be same. Another issue I observed is that changing/clearing country doesn’t clear state field’s value. PFA test project, check out Addresses screen.

  • Select a country and then a state
  • Update/clear country, state field won’t be cleared (381.3 KB)

This is correct. You should do it programmatically in the controller:

public class AddressBrowse extends MasterDetailScreen<Address> {

    private EntityComboBox<State> stateField;

    public void onCountryFieldValueChange(HasValue.ValueChangeEvent<Country> event) {

Thanks for confirming. Do you see any issue in the code below to implement cascading dropdowns for Country and State?

    <collection id="countriesDc" class="com.test.Country">
        <fetchPlan extends="_base">
            <property name="states" fetchPlan="_base"/>
        <loader id="couontriesDl">
                <![CDATA[select e from Country]]>
        <collection id="statesDc" property="states"/>

The code is fine, but it works only if you have a collection property in the master entity, which is not always the case.

Besides, here States are loaded for all Countries at once, which is not good if you have a lot of instances (perhaps it’s fine for countries and states). With standalone child container, you load dependent entities only for a single selected master entity, so even if you have thousands of master instances, you will have only a single master and its children in memory at a time.

1 Like