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