We have the following code in place when a user presses the ESC key we execute a post back to clear our screen:
// capture ENTER and execute Search, ESC and execute Clear. $(document).keypress(function (e) { if (e.which == "13") { //enter <-- Works document.getElementById('MainContent_btnSearch').click(); return false; } if (e.which == "27") { // escape <-- fails when focus is in an Infragistics control. document.getElementById('MainContent_btnClear').click(); return false; } });
It appears that the Infragistics control also uses the ESC to clear the value from the control. Is there a way to prevent/override the Infragistics control from eating the ESC key?
The code handling the Enter key works fine in the same scenario.
This needs to be moved to Commands and Editors
<label for="MainContent_WebTabMaster_WebTabCommon_BscControl_9_17_51" id="MainContent_WebTabMaster_WebTabCommon_lblBscControl_9_17_51" class="dynamicFieldsCaptionLabel">Business Unit</label><br /><input type="hidden" id="MainContent_WebTabMaster_WebTabCommon_BscControl_9_17_51_clientState" name="MainContent_WebTabMaster_WebTabCommon_BscControl_9_17_51_clientState" /><input title="{0}" id="MainContent_WebTabMaster_WebTabCommon_BscControl_9_17_51" readonly="readonly" name="MainContent_WebTabMaster_WebTabCommon_BscControl_9_17_51" class="igte_RedPlanetEdit" type="text" style="color:windowtext;background-color:window;width:66%;text-align:notset;" />
Hello Pete,
Please feel free to contact us if you have any additional questions regarding this matter.
Hi Pete,
There will be no updates for Infragistics.WebUI controls. Therefore, I suggest you to get around by using codes, which I already provided. The easiest way to prevent canceling Esc key (or in fact any other browser event) for all Infragistics controls on page, is to customize logic of ig_cancelEvent. If you need to put <script> with custom override codes in <head>, then you should use "load/initialize" events, like body.onload: see codes in previous response. If you do not mind inserting script block within <body> or other container, then there is no need to process body.onload. You may insert following codes at the very end of <body> or after <body>.
<script type="text/javascript">var old_ig_cancelEvent = window.ig_cancelEvent;ig_cancelEvent = function (evt) { if (!evt || evt.keyCode === 27 || evt.which === 27) return; old_ig_cancelEvent(evt);}</script>
What I need to do is, when a user is in an Infragistic control instead of clearing the value of the control I need to run our code instead. It seems the Infragisicts control is eating the ESC key. Is there a property to turn that off? If I am not in an Infragistics control the application behaves as expected.
The other challenge is, we are dynamically adding controls, there are 20+ controls on a screen.
Thanks,
Helllo Pete,
Please do not hesitate to contact us if you have any additional questions regarding this matter.