then-purpleT
Refine3y ago
9 replies
then-purple

Debounce on list table CRUD search

 const { tableProps, searchFormProps } = useTable<IUser, HttpError, IUserFilterVariables>({
        syncWithLocation: true,
        onSearch: (params) => {
            const filters: CrudFilters = []
            const { team_name } = params
            filters.push(
                {
                    field: "team_name",
                    operator: "contains",
                    value: team_name,
                },
            );

            return filters;
        },
    });

  <Form
                {...searchFormProps}
                layout="horizontal"
                onValuesChange={() => searchFormProps.form?.submit()}
            >
                <Space wrap>
                    <Form.Item name="team_name">
                        <Input
                            placeholder="Team 01, etc."
                            prefix={<SearchOutlined />}
                        />
                    </Form.Item>
                </Space>
            </Form>

Add debounce on search
Was this page helpful?