Filter field with EnterPressListener similar to TextField

Hi CUBA community,

I’m looking for the possibility to add an EnterPressListener to an field in a filter (similar as for TextField).
The action should then do the search for this filter.

grafik

Is there a way to add to the filter field such a listener? I don’t find anything regarding this in the docu or the forum - or is this not possible at all?

Thanks in advance
Steven

Hi!

Unfortunately, you can’t get access to the Search Button, but as a workaround, you can put your filter to the vbox and add ShortcutAction.

For instance:
XML layout:

<vbox id="vbox">
    <filter id="filter"
            applyTo="customersTable"
            datasource="customersDs">
        <properties include=".*"/>
    </filter>
</vbox>

Controller:

@Inject
private VBoxLayout vbox;

@Inject
private Filter filter;

@Override
public void init(Map<String, Object> params) {
    vbox.addShortcutAction(new ShortcutAction("ENTER",
            shortcutTriggeredEvent -> filter.apply(true)));
}

Hi Roman,

your ‘workaround’ sounds for me as a solution - works perfect.
Thanks a lot.

Steven