Hi,
I have a valuelist assigned to a column for a ultragrid. which are working fine.
I have a requirement to allow cancelable changes in the value list.
I want to reset selection to previously selected item if the user cancels the valuelist dropdown (by pressing esc key or clicking somewhere in the form). I want to update the underlying cell value only if the user presses enter key or explicitly clicking over the item in the value list.
Example scenario,
1. User clicks the dropdown arrow in the first cell of the ultragrid.
2. The dropdown will open.
3. The user changes the value by the arrow keys in the dropdown (up/down). That will changes the value
4. Presses the Esc. (Or click outside of the dropdown so that it will close.)
5. The cell keeps the new value. I want to revert it back to the previous value because the user pressed esc.
Is there a way to do that?
Using the arrow keys to select a value form the list does not change the Value of the cell. It will change the selected index of the ValueList and it will change the Text of the cell. But the cell's Value will still return the original value from the underlying data source.
If the user presses the escape key again (after the dropdown is closed), then the current cell's changes will revert to the original value. Pressing escape again after that will revert any changes in the entire row.
In order to do what you are suggesting, you would have to be able to detect that the user closed the valuelist via the escape key. If you could detect that, then you could cancel the changes to the cell or row, but I don't believe there is any way to do that currently.
You could Submit a Feature Request and maybe a new event could be added in the future to allow you to detect this case, but right now, I see no way to do it.
Thanks for your replies mike.
I will try with your suggestions.