1 Answer, 1 is accepted
Hello, Abhishek,
I tested the described scenario but the Combobox is properly closed at my end when I click outside the cell containing it. Can you compare the setup in the sample below with your actual ones and see how to differ?
If comparing is not enough to pinpoint the issue, can yo, please, update the sample above up to a point where the issue occurs and send it back so I can examine it further?
Kind regards,
Vessy
Progress Telerik
Do you have a stake in the designеr-developer collaboration process? If so, take our survey to share your perspective and become part of this global research. You’ll be among the first to know once the results are out.
-> Start The State of Designer-Developer Collaboration Survey 2024
Sure, Abhishek, I will be glad to help you but I will need to examine the exact setup leading to the problem in order to be able to assist you further on this. Can you, please, prepare a runnable Stackblitz sample where I can reproduce the problem and examine its implementation at my end?
You can use the sample provided in my previous reply as a base if it will be easier for you.
Hi. i am attaching the sample link. If i click on the dropdown or any other custom cell & when i click out side without changing any value, the dropdown is still in active state. Please help on this.
https://stackblitz.com/edit/react-czmt6w-ikztrs?file=app%2Frenderers.jsx,app%2Fmain.jsx,app%2FcustomCells.jsx
Hi, Abhishek,
To ensure that the DropDownCell exits edit mode when you click outside of the grid, you'll need to detect clicks outside the grid and trigger the exitEdit function. You can do it by handling the mousedown event of the document and checking if the click happened outside the grid, and if it did, we’ll call the exitEdit function.
You can see a sample demonstrating this approach here:
React.useEffect(() => {
const handleClickOutside = (event) => {
// Check if the click is outside the grid container
if (gridRef.current && !gridRef.current?.contains(event.target)) {
exitEdit();
}
};
document.addEventListener('mousedown', handleClickOutside);
return () => {
document.removeEventListener('mousedown', handleClickOutside);
};
}, []);
Hi, Abhishek,
We tested the scenario further and found that the root of the problem is actually that the DropDownList is not focussed when the cell enters in edit mode. Forcing the focusing of the DropDownList component initially should boost the performance of the page and will allow you to exit the editing when clicking outside the Grid in the same time:
I noticed 1 issue in the above mentioned example. if u select the dropdown & dont change any value & if u click outside, the dropdown is still in active state. 1st row is still active even though i clicked outside