Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested filter property can't be used for keyValue containers #3261

Open
gorbunkov opened this issue Mar 5, 2022 · 0 comments
Open

Nested filter property can't be used for keyValue containers #3261

gorbunkov opened this issue Mar 5, 2022 · 0 comments
Labels
type: bug Something isn't working

Comments

@gorbunkov
Copy link
Contributor

Platform version: 7.2.18

Suppose, there is a KeyValueCollection in the screen:

        <keyValueCollection id="ordersKvDc">
            <loader id="ordersKvDl">
                <query>
                    select o, c from reptest_Order o join o.customer c
                </query>
            </loader>
            <properties>
                <property name="order" class="com.company.reptest.entity.Order"></property>
                <property name="customer" class="com.company.reptest.entity.Customer"></property>
            </properties>
        </keyValueCollection>

If in the <filter> component we define a nested property (like order.number, not just order):

        <filter id="filter"
                applyTo="ordersTable"
                dataLoader="ordersKvDl">
            <property name="order.number" caption="orderNumber"/>
            <property name="customer.name" caption="customerName"/>
        </filter>

then when we try to add a filter condition, we get the following exception:

com.haulmont.cuba.core.global.DevelopmentException: The number of KeyValueEntity properties required is greater than the number of the selected expressions in the data loader query
	at com.haulmont.cuba.gui.components.filter.addcondition.ConditionDescriptorsTreeBuilder.createConditionDescriptorForKeyValueMetaProperty(ConditionDescriptorsTreeBuilder.java:265)
	at com.haulmont.cuba.gui.components.filter.addcondition.ConditionDescriptorsTreeBuilder.build(ConditionDescriptorsTreeBuilder.java:128)
	at com.haulmont.cuba.gui.components.filter.AddConditionHelper.addCondition(AddConditionHelper.java:94)
	at com.haulmont.cuba.gui.components.filter.FilterDelegateImpl.lambda$createControlsLayoutForGeneric$2(FilterDelegateImpl.java:344)
	at com.haulmont.bali.events.EventHub.publish(EventHub.java:170)
	at com.haulmont.cuba.web.gui.components.WebAbstractComponent.publish(WebAbstractComponent.java:100)
	at com.haulmont.cuba.web.gui.components.WebButton.buttonClicked(WebButton.java:70)
	at com.haulmont.cuba.web.widgets.CubaButton.fireClick(CubaButton.java:76)
	at com.vaadin.ui.Button$1.click(Button.java:57)

See forum topic.

The sample project: reptest.zip

Open the Orders screen and try to add a filter condition

@gorbunkov gorbunkov added the type: bug Something isn't working label Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant