Completed
Last Updated: 17 Feb 2021 07:09 by ADMIN
Imported User
Created on: 01 Nov 2018 00:54
Category: KendoReact
Type: Feature Request
1
ComboBox maxLength property
We have database constraints on certain fields e.g. varchar(10) and would like to prevent the user from entering invalid data into the combo box fields. If it's not too much trouble a minLength field would also be convenient.
3 comments
ADMIN
Stefan
Posted on: 17 Feb 2021 07:09

Hello, Brent,

Thank you for sharing this approach with the KendoReact community.

I'm sure it will prove helpful to others.

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Brent
Posted on: 16 Feb 2021 19:41

in case it helps others landing here... for us, managing the combobox filter prop got into too much dependency with the value prop... we went with DOM manipulation to simply set the native <input maxLength>... DOM is of course frowned upon with React but avoided significantly more complexity.

rough sample:

export const MyPageComponentReact.FC = () => {
    const comboRef = useRef(null);
    useEffect(() => {
        const nativeInput = (ReactDOM.findDOMNode(comboRef.currentas HTMLElement)?.querySelector('input');
        nativeInput && (nativeInput.maxLength = comboMaxLength);
        // eslint-disable-next-line react-hooks/exhaustive-deps

    }, []);

return <div>

<ComboBox
     ref={comboRef}
        allowCustom={true}
// ... etc...
/>

</div>;
}

ADMIN
Stefan
Posted on: 19 Feb 2019 13:06
Hello,

We have a demo demonstrating how this can be done:

https://www.telerik.com/kendo-react-ui/components/dropdowns/combobox/filtering/#toc-minimum-filter-length


Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items