Allow passing a 'no_onload' paramter to signify to immediatly execute the inline...
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 9 Mar 2010 17:51:29 +0000 (12:51 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 9 Mar 2010 17:54:36 +0000 (12:54 -0500)
Needed for attaching the autocompleter when outputing the autocompleter in an ajax chunk

framework/Ajax/lib/Horde/Ajax/Imple/AutoCompleter.php

index 526fd9c..a075ff9 100644 (file)
@@ -18,6 +18,7 @@ abstract class Horde_Ajax_Imple_AutoCompleter extends Horde_Ajax_Imple_Base
      * @param array $params  Configuration parameters.
      * <pre>
      * 'triggerId' => (string) [optional] TODO
+     * 'no_onload' => (boolean) [optional] Don't wait for dom:onload to attach
      * </pre>
      */
     public function __construct($params)
@@ -85,7 +86,7 @@ abstract class Horde_Ajax_Imple_AutoCompleter extends Horde_Ajax_Imple_Base
 
         Horde::addScriptFile('effects.js', 'horde');
 
-        Horde::addInlineScript((isset($config['var']) ? $config['var'] . ' = ' : '') . 'new ' . $func . '(' . implode(',', $params) . ',' . $js_params . ')', 'dom');
+        Horde::addInlineScript((isset($config['var']) ? $config['var'] . ' = ' : '') . 'new ' . $func . '(' . implode(',', $params) . ',' . $js_params . ')', empty($this->_params['no_onload']) ? 'dom' : null);
     }
 
     /**