Keyboard event in child table

I want to do something while user entering items and keypress ‘keyboard key’ on Sales Invoice

frappe.ui.form.on("Sales Invoice", "refresh", function(frm, cdt, cdn){
cur_frm.get_field("items").$input.on("onkeypress", function() 
{ 	
	e = window.event;
	if (e.keycode == '38')alert('yes');

});
});

Not working…any example reference?

Thanks

3 Likes

I am also searching for the same instance

does this help?

Have you found any solution, i am also looking for the same.

Hi you can try below code:

onload_post_render: function(frm) {
frm.fields_dict.items.grid.wrapper.on(‘keypress’, ‘input[data-fieldname=“qty”][data-doctype=“Material Request Item”]’, function(event) {

  		if(event.keyCode < 48 || event.keyCode > 57)
  		{
  			return false;
  		}
  		
  	});

},