ERPNext Conference 2019* ERPNext.com Blog

Keyboard event in child table


#1

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


#2

I am also searching for the same instance


#3

does this help?


#5

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


#6

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;
  		}
  		
  	});

},