Fix: avoid focus problem when select2 is in a modal dialog window
This commit is contained in:
parent
04aafbc493
commit
199bf4c044
@ -386,10 +386,11 @@ function ajax_autoselect($htmlname, $addlink='')
|
||||
* @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete
|
||||
* @param int $forcefocus Force focus on field
|
||||
* @param string $widthTypeOfAutocomplete 'resolve' or 'off'
|
||||
* @param string $modalid ID of modal (for avoid focus problem when select2 is in a modal dialog window)
|
||||
* @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason.
|
||||
* @see selectArrayAjax of html.form.class
|
||||
*/
|
||||
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve')
|
||||
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $modalid='dialog-confirm')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -425,7 +426,8 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
|
||||
},
|
||||
escapeMarkup: function(markup) {
|
||||
return markup;
|
||||
}
|
||||
},
|
||||
dropdownParent: $(\'#'.$modalid.'\')
|
||||
})';
|
||||
if ($forcefocus) $msg.= '.select2(\'focus\')';
|
||||
$msg.= ';'."\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user