kendo grid - KendoGrid popup edit window, Form field set focus using jquery -
context: kendogrid
editing set popup. opens popup window fields in it, in case template editing window custom js logic etc. tabindex
values have been set fields in order want , autofocus set on first field. have custom js runs on edit event of grid position , size window when pops open: function editwindowlocation(e)
observation: relatively simple js code if form , fields static doing like: document.formname.fieldname.focus();
problem: after window pops open, new window has focus. when tab key pressed, sends focus buttons on window (update/cancel) more tabbing later, reaches fields. how first field in popup window focus, tabbing set focus other fields in order index set?
solution: @ end of function editwindowlocation(e)
added little bit of code find first tabindex
, set focus it.
settimeout(function () { $("input[tabindex=1]").focus(); }, 1000);
why timeout say? kendowindow somehow overriding .focus()
event , placing focus on div
makes kendowindow
. when done in timeout, works expected. not sure why happens, worked me.
hope helps people similar issues.
Comments
Post a Comment