Added function for control icon changes

This commit is contained in:
José González 2021-05-07 11:17:20 +02:00
parent 9288a31e58
commit 856186ee59
1 changed files with 23 additions and 19 deletions

View File

@ -5178,6 +5178,11 @@ function ui_print_agent_autocomplete_input($parameters)
$javascript_function_change = '';
// Default value.
$javascript_function_change .= '
function setInputBackground(inputId, image) {
$("#"+inputId)
.css("background","url(\'"+image+"\') right center no-repeat");
}
function set_functions_change_autocomplete_'.$input_name.'() {
var cache_'.$input_name.' = {};
@ -5194,8 +5199,7 @@ function ui_print_agent_autocomplete_input($parameters)
}
//Set loading
$("#'.$input_id.'")
.css("background","url(\"'.$spinner_image.'\") right center no-repeat");
setInputBackground("'.$input_id.'", "'.$spinner_image.'");
//Function to call when the source
if ('.((int) !empty($javascript_function_action_into_source_js_call)).') {
@ -5209,8 +5213,7 @@ function ui_print_agent_autocomplete_input($parameters)
response(cache_'.$input_name.'[groupId][term]);
//Set icon
$("#'.$input_id.'")
.css("background","url(\"'.$icon_image.'\") right center no-repeat '.$icon_image.'");
setInputBackground("'.$input_id.'", "'.$icon_image.'");
return;
}
else {
@ -5229,6 +5232,8 @@ function ui_print_agent_autocomplete_input($parameters)
found = true;
//Set icon
setInputBackground("'.$input_id.'", "'.$icon_image.'");
return;
}
});
@ -5237,6 +5242,11 @@ function ui_print_agent_autocomplete_input($parameters)
break;
}
}
//Set icon
setInputBackground("'.$input_id.'", "'.$icon_image.'");
return;
*/
}
//==================================================
@ -5244,11 +5254,8 @@ function ui_print_agent_autocomplete_input($parameters)
if (found) {
//Set icon
$("#'.$input_id.'")
.css("background","url(\"'.$icon_image.'\") right center no-repeat");
setInputBackground("'.$input_id.'", "'.$icon_image.'");
select_item_click = 0;
return;
}
@ -5259,20 +5266,17 @@ function ui_print_agent_autocomplete_input($parameters)
dataType: "json",
success: function (data) {
cache_'.$input_name.'[groupId][term] = data; //Save the cache
response(data);
//Set icon
$("#'.$input_id.'")
.css("background",
"url(\"'.$icon_image.'\") right center no-repeat");
setInputBackground("'.$input_id.'", "'.$icon_image.'");
select_item_click = 0;
return;
}
});
setInputBackground("'.$input_id.'", "'.$icon_image.'");
return;
},
//---END source-----------------------------------------