I have a grid with Activation behavior enabled. I defined a custom Javascript to be executed on ActiveCellChanging, where I check the key pressed. Code is:
function grdDetail_ManageKeyPress(sender, e) {
var evtobj = window.event ? event : e.get_browserEvent(); if (evtobj.keyCode == 13) { sender.get_behaviors().get_editingCore().get_behaviors().get_cellEditing().enterEditMode(e.getCurrentActiveCell()); e.set_cancel(true); }
}
It works well in IE and Chrome (where window.event is defined) but fails in Firefox. Problem is that, in ActiveCellChanging and ActiveCellChanged javascript events, get_browserEvent() always returns null (checked on all browsers). In other events (like SelectionChanged for a WebDropDown) i can use get_browserEvent() successfully on all browsers.
How can I check the key pressed in these events while moving around the grid in Firefox?
Another thing: in Chrome and IE, the selected cell is highlighted (in Chrome with the webkit default border, in IE with a dotted border), in Firefox it's impossible to check which cell is selected. How can I add a border to the selected cell?
I'm using .NET Advantage 2012.1 (without any SR), Visual Studio 2010 and Framework 4.0.
I'd be thankful if you can answer me a bit quickly, it's quite urgent because I must deploy my app to my client.
Hello elvander,
I would suggest you to use selection behavior in addition to activation - this way the active cell will also be selected and thus highlighted. And you should be able to get the key pressed from the browserEvent in KeyDown event.
Let me know if you have any questions.
Hi elvander,
If you need any further assistance with the matter, please do not hesitate to ask.
Hi Nikolay. Thanks for the support.
Unfortunately the solution you provided does not work. I tried managing the KeyDown event to save the key pressed, but I noticed that both CellSelectionChanging and ActiveCellChanging events are triggered BEFORE the KeyDown event. In this way, I cannot save the browser event and use it in the proper function. Precisely, I noticed that events are triggered in this order: ActiveCellChanging, CellSelectionChanging, KeyDown.
Hello elvandar,
I have investigated this further and it seems that these events are designed like that. A possible workaround could be to get the required information from the selection/activation changed event and use it in keyDown event where you can access the key code of the pressed button to perform the needed operations.
However, the ability to get browser event from the grid’s client-side events has been determined as a new Product Idea. I have sent your Product Idea directly to our product management team. Our product team chooses new Product Ideas for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested ideas, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your idea is chosen for development, you will be notified at that time. Your reference number for this Product Idea is PI12110005.
If you would like to follow up on your Product Idea at a later point, you may contact Developer Support management via email. Please include the reference number of your Product Idea in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com.
If you need more information, please let me know.