I'm creating a custom listNoDataRender for autocomplete.
I wanted to add link that either redirects or updates the state, see my code below.
Unfortunately, clicking the button doesn't trigger the onClick handler, it only closes the suggestion list.
How do i trigger the onClick handler and not close the suggestion list? TIA!
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { DropDownList } from '@progress/kendo-react-dropdowns';
const App = () => {
const handleClick = () =>{
// update state or redirect here...
}
const listNoDataRender = (element: React.ReactElement<HTMLDivElement>) => {
const noData = (
<h4 style={{ fontSize: '1em' }}>
<span className="k-icon k-i-warning" style={{ fontSize: '2.5em' }} />
<br /><br />
<button onClick={handleClick}>Did you mean reco..</button>
</h4>
);
return React.cloneElement(element, { ...element.props }, noData);
}
return (
<DropDownList
style={{ width: '300px' }}
data={[]}
listNoDataRender={listNoDataRender}
/>
);
}
ReactDOM.render(
<App />,
document.querySelector('my-app')
);