Merge pull request #1976 from frederic34/patch-2

Add a little delay in ajax_autocompleter
This commit is contained in:
Laurent Destailleur 2014-11-04 17:41:23 +01:00
commit 5c2862dae3
2 changed files with 5 additions and 2 deletions

View File

@ -1835,11 +1835,12 @@ class Form
* @param string $filterkey Filtre des produits
* @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $limit Limit of line number
* @return array Array of keys for json
*/
function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0)
function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100)
{
global $langs,$conf;
global $langs,$conf,$db;
$out='';
$outarray=array();
@ -1877,6 +1878,7 @@ class Form
$sql.=')';
}
$sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC";
$sql.= $db->plimit($limit);
// Build output string

View File

@ -173,6 +173,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
}
$("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified
}
,delay: 500
}).data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
.data( "item.autocomplete", item )