Custom filter field

I have some filter configurations I’ve defined in my screen descriptor. One of them is a jpqlFilter on a many-to-many relationship (call the entities A and B) where I am searching for instances of A whose bList contains a specific instance of B. My filter seems to function correctly. However, I’d like to make the field an EntityComboBox instead of an EntityPicker. How could I do this?

Hi
May be this help
https://demo.jmix.io/sampler/#main/8/sample?id=propertyfilter-customfield

Also

                <configuration id="configuration_common" operation="AND"
                               name="msg://filter.common" default="true">
                    <propertyFilter property="myProperty" operation="EQUAL" operationEditable="false"
                                    caption="msg://filter.common.myProperty.caption">
                        <entityComboBox metaClass="myProperty" optionsContainer="myEntityDc"/>
                    </propertyFilter>
				</configuration>

Is this compatible with a jpqlFilter?

When I try to replicate it in my jpqlFilter it get an exception IllegalStateException: DataLoader has already been initialized when I add the filter condition to my screen.

When I remove the dataLoader attribute from the filter, I can add the filter condition but it doesn’t populate entityComboBox with the list from my data container.

If it helps, I am on Jmix 1.5

Hi!

Could you please provide a test project?
I can’t reproduce the problem in my project with version 1.5.4

Regards,
Dmitriy

filter-example.zip

I added a custom filter to pet-browse.xml. It is the custom filter that is not loading the data for the entityComboBox.

I also added jmix.ui.component.entityFieldType.[petclinic_Owner] = entityComboBox to my application.properties file.

Help?

Hi!

I opened your test project and checked the functionality of the custom filter configuration.

It looks like everything is working correctly:
image

You specified the entityComboBox as a field for selecting values and also specified that it should use the following container as selecting options.

Perhaps I don’t fully understand the context of the problem that has arisen?
Could you please clarify what behavior you would expect in this case?

Regards,
Dmitriy

OH! I see the miscommunication.

I am selecting the filter form the Add condition screen (see below), NOT from the configuration dropdown next to the Refresh button.

image

Selecting from the configuration drop down does work as you described.

But I need to be able to mix and match these fields with the standard/auto-generated property conditions. Does this use case make sense?

Looks like an artificial limitation. I will discuss this issue with my colleagues. For now, I’ll create a ticket so I don’t forget: JpqlFilter generation strategy ignores the entity-field-type application property · Issue #2516 · jmix-framework/jmix · GitHub

Thanks for the reporting.

Best regards,
Dmitriy

1 Like