2
0
forked from Wavyzz/dolibarr

Try to fix differently pb of change/keyup because current change has a

regression (no way to use ajax select onto supplier orders when using
keybord or mouse selection).
This commit is contained in:
Laurent Destailleur
2012-11-26 13:33:18 +01:00
parent d9fb0c941b
commit c9edac9cd6

View File

@@ -49,8 +49,13 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
// Remove product id before select another product // Remove product id before select another product
// use keyup instead change to avoid loosing the product id // use keyup instead change to avoid loosing the product id
$("input#search_'.$htmlname.'").keyup(function() { $("input#search_'.$htmlname.'").keydown(function() {
$("#'.$htmlname.'").val("").trigger("change"); //console.log(\'purge_id_after_keydown\');
$("#'.$htmlname.'").val("");
});
$("input#search_'.$htmlname.'").change(function() {
//console.log(\'keyup\');
$("#'.$htmlname.'").trigger("change");
}); });
// Check when keyup // Check when keyup
$("input#search_'.$htmlname.'").onDelayedKeyup({ handler: function() { $("input#search_'.$htmlname.'").onDelayedKeyup({ handler: function() {
@@ -116,6 +121,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
dataType: "json", dataType: "json",
minLength: '.$minLength.', minLength: '.$minLength.',
select: function( event, ui ) { select: function( event, ui ) {
//console.log(\'set value of id with \'+ui.item.id);
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); $("#'.$htmlname.'").val(ui.item.id).trigger("change");
// Disable an element // Disable an element
if (options.option_disabled) { if (options.option_disabled) {