I have a rather unusual scenario and would love to know if there’s a workaround or a creative solution!
In my grid, I use autocomplete cells with long selection lists (20 to 50 items). I’d like these autocomplete cells to behave slightly differently: on the first click, I want the dropdown to open and display all available options immediately.
I tried implementing a creative solution, but it led to some unintended side effects. Here’s what I did:
- On the
afterBeginEditing
event, I attached a function that clears the current selection, which makes the list visible. - However, if the user clicks outside the dropdown (closing it without selecting anything), the system ends up saving an empty value.
To address this, I introduced a variable (e.g., validClickedSelection
) that tracks whether a valid selection was made. This variable is set to true
using a mousedown
listener on .listbox
:
$(document).on("mousedown", ".listbox", function (e) { /* logic here */ });
Then, in the beforeChange
event, I validate this variable to decide whether to commit the value.
The problem is that beforeChange
is triggered before the mousedown
event, so the logic doesn’t work as intended.
Is there a better approach or workaround you’d recommend?
Thank you in advance for your help!