I have this code to set focus to a textbox on a row in the treegrid. It works very good for a double click beginEdit event.
However, when I add a record using a button and invoke it on the add requestType the field seems to briefly have focus then loses it. Is there another event or way I can set the focus on record add events?
Hi Farveen,
What's happening is that the user may have a row open, so I am calling closeEdit before addRecord. I've modified your sample with that code and now the issue should be showing up.
https://stackblitz.com/edit/angular-lxf95c-shs4wi?file=app.component.html
|
actionComplete(args)
{
if (args.requestType == 'beginEdit' || args.requestType == 'add')
{
var item = args.form.elements.namedItem('approved');
var htmlItem = item as HTMLElement;
setTimeout(function() {
htmlItem.focus();
}, 0);
}
} |