onEditKeyPress implementation example

hello,

Is there an example of how the onEditKeyPress works?
Do you attach that event directly to the datatable view or to an editor? Ive tried both with no success.
Ive attached a onAfterEditStart event to a datatable in that event function I have:

var editor = this.getEditor();
editor.attachEvent(‘onEditKeyPress’,function(code,e){console.log(‘test’)});

I get an error that ‘attachEvent’ is not a function of ‘editor’

I have a custom popup for a datatable column and what Im trying to accomplish is, is to capture the ‘up’ key in the column editor to shift focus from the editor to the custom popup like what happens in standard column suggests.

Thanks,
Pieter

Good day @Pieter ,

editor.attachEvent(‘onEditKeyPress’,function(code,e){console.log(‘test’)}); won’t work as attachEvent() works only with widgets and an editor is not the one.

Instead, you could attach an event to the editor’s input node with webix.event. It helps to attach an event handler to an HTML element. Also, it will be detached together with the editor so you will not have to detach it separately.
You may do it in your onAfterEditStart event and attach a keydown event, for example : Code Snippet .

Thank you for the example!