EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: arma on June 29, 2014, 08:42:34 PM



Title: Commit changes On enter of editable grid textbox
Post by: arma on June 29, 2014, 08:42:34 PM
Hi,

I have editable grid with one editable column using textbox for entering integer input.
How could i trigger on enter keypress of the editable textbox column so i could commit and do loop and recalculate the total of amount manually.

Thanks.


Title: Re: Commit changes On enter of editable grid textbox
Post by: stworthy on June 30, 2014, 12:21:15 AM
Get the editor that bound to a column and you will be able to bind any events on it.
Code:
var dg = $('#dg');
dg.datagrid('beginEdit', index);
var ed = dg.datagrid('getEditor',{index:index,field:...});
$(ed.target).bind('keydown',function(e){
  if (e.keyCode == 13){
    dg.datagrid('endEdit', index);
  }
})