How can i validate on list-view

My jmix version: 2.1.0

How can I validate in list-view:
I want to validate some fields in the list-view screen, i already tried to generate default handler such as
OperationChangeEvent, ComponentValueChangeEvent, validator and all of them cant work
image

@Subscribe("ccyCodeField")
    public void onCcyCodeFieldOperationChange(final PropertyFilter.OperationChangeEvent<?> event) {
        
    }

and I got

DevelopmentException: Unable to find @Subscribe target ccyCodeField in GdCurrencyListView
@Subscribe("ccyCodeField")
    public void onCcyCodeFieldComponentValueChange(final AbstractField.ComponentValueChangeEvent<PropertyFilter<?>, ?> event) {
        
    }

and I got

DevelopmentException: Unable to find @Subscribe target ccyCodeField in GdCurrencyListView
@Install(to = "ccyCodeField", subject = "validator")
    private void ccyCodeFieldValidator(final Object t) {
        
    }

and I got

DevelopmentException: Unable to find @Install target for method private void com.fis.pbcapcore.view.gdcurrency.GdCurrencyListView.ccyCodeFieldValidator(java.lang.Object) in class com.fis.pbcapcore.view.gdcurrency.GdCurrencyListView

all of them are default generate handler

here’s my xml file

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<view xmlns="http://jmix.io/schema/flowui/view"
      xmlns:c="http://jmix.io/schema/flowui/jpql-condition"
      title="msg://gdCurrencyListView.title"
      focusComponent="gdCurrenciesDataGrid">
    <data>
        <collection id="gdCurrenciesDc"
                    class="com.fis.pbcapcore.entity.GdCurrency">
            <fetchPlan extends="_local"/>
            <loader id="gdCurrenciesDl" readOnly="true">
                <query>
                    <![CDATA[select e from GdCurrency e where e.deleted = 'N' order by e.id asc]]>
                </query>
            </loader>
        </collection>
    </data>
    <facets>
        <dataLoadCoordinator auto="true"/>
        <urlQueryParameters>
            <genericFilter component="genericFilter"/>
            <pagination component="pagination"/>
        </urlQueryParameters>
    </facets>
    <actions>
        <action id="selectAction" type="lookup_select"/>
        <action id="discardAction" type="lookup_discard"/>
    </actions>
    <layout>
        <genericFilter id="genericFilter"
                       dataLoader="gdCurrenciesDl">
            <properties include=".*"/>

            <configurations>
                <configuration id="gdCurrencyDefaultConfiguration" default="true" name="msg://gdCurrencyDefaultConfiguration.name">
                    <propertyFilter id="ccyCodeField" property="ccyCode" operation="CONTAINS" operationEditable="false"/>
                    <propertyFilter id="ccyCodeNumField" property="ccyCodeNum" operation="CONTAINS" operationEditable="false"/>
                    <propertyFilter id="ccyNameField" property="ccyName" operation="CONTAINS" operationEditable="false"/>
                    <propertyFilter id="statusField" property="status" operation="EQUAL" operationEditable="false"/>
                    <groupFilter id = "dateGroupFilterField" operation="AND" summaryText="Và">
                        <propertyFilter id="fromDateField" property="createdDate" operation="GREATER_OR_EQUAL" operationEditable="false"/>
                        <propertyFilter id="toDateField" property="createdDate" operation="LESS_OR_EQUAL" operationEditable="false"/>
                    </groupFilter>
                </configuration>
            </configurations>
        </genericFilter>
        <hbox id="buttonsPanel" classNames="buttons-panel">
            <button id="createBtn" action="gdCurrenciesDataGrid.create"/>
            <button id="editBtn" action="gdCurrenciesDataGrid.edit"/>
            <button id="readBtn" action="gdCurrenciesDataGrid.read"/>
            <dropdownButton id="additionalBtn" text="msg:///commonExporter.label" icon="DOWNLOAD">
                <items>
                    <actionItem id="exportExcelBtn" ref="gdCurrenciesDataGrid.exportExcel"/>
                    <actionItem id="exportJsonBtn" ref="gdCurrenciesDataGrid.exportJson"/>
                </items>
            </dropdownButton>
            <simplePagination id="pagination" dataLoader="gdCurrenciesDl"/>
        </hbox>

        <dataGrid id="gdCurrenciesDataGrid"
                  width="100%"
                  minHeight="20em"
                  dataContainer="gdCurrenciesDc"
                  columnReorderingAllowed="true">
            <actions>
                <action id="create" type="list_create"/>
                <action id="edit" type="list_edit"/>
                <action id="read" type="list_read"/>
                <action id="exportExcel" type="grdexp_excelExport"/>
                <action id="exportJson" type="grdexp_jsonExport"/>
                <action id="add"/>
            </actions>
            <columns resizable="true">
                <column property="id" visible="false" autoWidth="true"/>
                <column property="ccyCode" autoWidth="true"/>
                <column property="ccyName" autoWidth="true"/>
                <column property="ccyCodeNum" autoWidth="true"/>
                <column property="ccyUnit" autoWidth="true"/>
                <column property="decimalRoundNum" autoWidth="true"/>
                <column property="domesticCcy" autoWidth="true"/>
                <column property="status" autoWidth="true"/>
                <column property="baseCcy" autoWidth="true"/>
            </columns>
        </dataGrid>
        <hbox id="lookupActions" visible="false">
            <button id="selectBtn" action="selectAction"/>
            <button id="discardBtn" action="discardAction"/>
        </hbox>
    </layout>
</view>

You are trying to subscribe to components dynamically created by genericFilter - it’s impossible.

If you need to validate filter input, use dedicated input controls like in the following example: Custom filter using declarative conditions.

1 Like