fastapi-amis-admin icon indicating copy to clipboard operation
fastapi-amis-admin copied to clipboard

The filter on input-group does not work

Open SergShulga opened this issue 2 months ago • 0 comments

I have the following field configuration in a model:

store_min_cost: float = Field(
        default=0.0, nullable=True, title="КЛ ₽(м2) min",
        amis_table_column={'type': "number", 'kilobitSeparator': True, 'sortable': True},
        amis_filter_item=
        {
            "type": "input-group",
            "description": "по умолчанию указан предельный диапазон",
            "validationConfig": {"errorMode": "partial"},
            "body": [
                {
                    "type": "input-text",
                    "size": "sm",
                    "source": "/get_filter_range/?mark=min&model=ComplexBase&field=store_min_cost",
                    "name": "s_min",
                    "autoComplete": False,
                    "validations": {"isNumeric": True, "maximum": "${s_max}"},
                    "validationErrors": {
                        "isNumeric": "Допустимо только числовое значение",
                        "maximum": "Не может превышать правое значение",
                    },
                },
                {
                    "type": "input-text",
                    "size": "sm",
                    "source": "/get_filter_range/?mark=max&model=ComplexBase&field=store_min_cost",
                    "name": "s_max",
                    "autoComplete": False,
                    "validations": {"isNumeric": True, "minimum": "${s_min}"},
                    "validationErrors": {
                        "isNumeric": "Допустимо только числовое значение",
                        "minimum": "Не может быть ниже левого значения",
                    },
                },
            ]
        }
    )

This grouping is necessary to set min\max values. I take the data for the limits from the API (that’s why I can’t use input-range - there is no way to dynamically specify the limit based on data from the database).

I see everything in the filter, 2

but the search does not react in any way to changing values. And when debugging, I see that the value from the form is not forwarded.

1

Any advice is welcome!

SergShulga avatar Apr 29 '24 18:04 SergShulga