Skip to content

Commit

Permalink
Merge pull request #5864 from hregis/4.0_bug
Browse files Browse the repository at this point in the history
Fix: add possibility to change width type to prevent some display issues
  • Loading branch information
eldy committed Nov 11, 2016
2 parents 2b2bd03 + 6423b23 commit fd1c0f4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions htdocs/core/lib/ajax.lib.php
Expand Up @@ -35,7 +35,7 @@
* @param string $urloption More parameters on URL request
* @param int $minLength Minimum number of chars to trigger that Ajax search
* @param int $autoselect Automatic selection if just one value
* @param array $ajaxoptions Multiple options array
* @param array $ajaxoptions Multiple options array
* Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
* Ex: array('disabled'=>
* Ex: array('show'=>
Expand All @@ -61,8 +61,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
$("input#search_'.$htmlname.'").keydown(function() {
$("#'.$htmlname.'").val("");
});
/* I disable this. A call to trigger is already done later into the select action of the autocomplete code
/* I disable this. A call to trigger is already done later into the select action of the autocomplete code
$("input#search_'.$htmlname.'").change(function() {
console.log("Call the change trigger on input '.$htmlname.' because of a change on search_'.$htmlname.' was triggered");
$("#'.$htmlname.'").trigger("change");
Expand Down Expand Up @@ -291,7 +291,7 @@ function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLengt
needtotrigger="#" + fields[i];
}
}
if (needtotrigger != "") // To force select2 to refresh visible content
{
// We introduce a delay so hand is back to js and all other js change can be done before the trigger that may execute a submit is done
Expand Down Expand Up @@ -358,7 +358,7 @@ function ajax_dialog($title,$message,$w=350,$h=150)
* @param int $forcefocus Force focus on field
* @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason.
*/
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0)
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve')
{
global $conf;

Expand All @@ -375,7 +375,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
$(document).ready(function () {
$(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({
dir: \'ltr\',
width: \'resolve\', /* off or resolve */
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
minimumInputLength: '.$minLengthToAutocomplete.'
})';
if ($forcefocus) $msg.= '.select2(\'focus\')';
Expand Down

0 comments on commit fd1c0f4

Please sign in to comment.