EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: wit_vivek on February 21, 2013, 08:21:14 PM



Title: can't move focus to controls in datagrid
Post by: wit_vivek on February 21, 2013, 08:21:14 PM
I am using datagrid plugin and when I hit new (new row), I want to move the focus to the first control of the row.
Thanks for your help in Advance.


Title: Re: can't move focus to controls in datagrid
Post by: stworthy on February 23, 2013, 01:29:24 AM
Are you using edatagrid plugin and calling 'addRow' method to append a new row? If so, get the first editor object and make it get focus after calling the 'addRow' method. The code looks like this:

Code:
var dg = $('#tt');
dg.edatagrid('addRow');
var index = dg.edatagrid('getRows').length-1;  // the editing row index
var ed = dg.edatagrid('getEditors', index)[0];  // get the first editor
$(ed.target).focus();