2 years ago

#50581

test-img

TanLuan

How to add filter for getMany() when using ReferenceArrayInput?

I'm using ReferenceArrayInput React Admin. However, there is issue for me when I selected item from suggestion items that is returned from API getList(). ex:/product?region_id="VN". Then React Admin auto call API GetMany() with list id, ex: /products?id=1 to get detail item info.

How can customize filter for above API, such as: /products?id=1&region_id="VN" instead because some product info such as: price, qty,... base on region.

<ReferenceArrayInput
                label="Products"
                source="product_ids"
                reference="products"
                allowEmpty={false}
                filter={{region_id: record?.region_id}}
                fullWidth
                filterToQuery={searchText => ({
                    q: searchText,
                })}
            >
                <AutocompleteArrayInput optionText={optionProductRenderer} validate={required()}/>
               
            </ReferenceArrayInput>

react-admin

0 Answers

Your Answer

Accepted video resources