Hi.
I am starting using the dxDataGrid from the Wisej.Web.Ext.DevExtreme package. At this point, I am trying to get the user key pressed. So, I changed the package and added the Data Map for the “keyDown” dxDataGrid event.
So far, I haven’t been able to find out how to get which key was pressed. From the DevEx docs I have noticed I would get the key pressed from the “event” entry in the Object with information about the function. So, I added to the package dxDataGrid.js:
case "keyDown":
return {
event: args.event
};
break;
This hasn’t worked, e.Data comes with “null” when I check it in the application using the grid.
Would anyone know what I should set in the dxDataGrid.js in order to be able to test which key has been pressed?
Thanks in advance.
Ivan
(Wisej 2.2.39.0 – C# – SQL Server)
Hi Ivan,
You can only return simple values (simple objects, primitives) back to the server. args.event tries to send complex dom objects and if you look in the browser console you’ll see the “Maximum Call Stack Exceeded” error.
If you want to get which keys are pressed, you can do something like this:
case "keyDown":
return {
key: args.event.key,
altKey: args.event.altKey,
keyCode: args.event.keyCode,
ctrlKey: args.event.ctrlKey,
metaKey: args.event.metaKey,
shiftKey: args.event.shiftKey
};
I’ll also go ahead and update the DX extension on GitHub with this as well!
HTH,
Levie
Hey Levie.
Thank you so much! That worked perfectly.
Yep, I noticed the error but didn’t really know its meaning… 🙂
Lots to learn, my friend.
Cheers.
Ivan
Please login first to submit.
