From 7e51ddd3b243485987369ed2a66569d09abbd03d Mon Sep 17 00:00:00 2001 From: Paul Driver Date: Wed, 3 Jun 2009 15:36:57 +0000 Subject: [PATCH] Making sure focus is set properly when tabbing through fields in the datatable editor --- www/extras/yui-webgui/build/form/datatable.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/www/extras/yui-webgui/build/form/datatable.js b/www/extras/yui-webgui/build/form/datatable.js index cedbf8ae9..96319828e 100644 --- a/www/extras/yui-webgui/build/form/datatable.js +++ b/www/extras/yui-webgui/build/form/datatable.js @@ -132,8 +132,10 @@ WebGUI.Form.DataTable */ this.handleEditorShowEvent = function ( obj ) { - obj.editor.focus(); - setTimeout( obj.editor.focus, 500 ); + /* If we set the focus now, something might (and sometimes does) set + * it later in the event handling chain. Let's defer the focus set + * until this chain is finished. */ + setTimeout(function() { obj.editor.focus() }, 0); }; /************************************************************************ @@ -144,7 +146,6 @@ WebGUI.Form.DataTable = function () { var row = this.dataTable.getLastTrEl(); this.dataTable.showCellEditor( row.firstChild ); - this.dataTable.getCellEditor().focus(); }; /************************************************************************