Change Filter Property Captions Programatically

Hi, I have an entity where I allow the user to configure the properties of its instances. So the entity has attributes such as amt1, amt2, etc. And the user is able to configure the fields as Price, Quantity, etc.

On the browse screen, I can change the table column headers from Amt1, Amt2 to Price, Quantity using the column setCaption method.

Is there anything like setCaption method in the Filter component so that the user can filter on Price, rather than Amt1?

Thanks

Did you mean change attributes caption in “add search condition” screen or in your pre-defined filters?

The attributes caption in “add search condition” screen. Thanks.

Hi, right now there is only one way to change the filter attribute caption: to specify it in the screen xml descriptor using the “caption” attribute:

<filter id="filter"
    applyTo="someTable"
    datasource="someDs">
            <property name="name" caption="msg://customName"/>
</filter>

But probably that’s not what you’re looking for. A complex way you may try is to override the com.haulmont.cuba.gui.components.filter.addcondition.ConditionDescriptorsTreeBuilder. It creates condition descriptors that are displayed in the “Add condition” dialog. You’ll have to modify the “caption” property of the descriptors you need.

1 Like

I figured there was no easy option. Thanks for the confirmation. And for pointing me in the right direction.