2
0
forked from Wavyzz/dolibarr

Test: search company with jQuery

This commit is contained in:
Regis Houssin
2010-10-08 14:15:21 +00:00
parent 1b05bb9686
commit 1af2a5025f
4 changed files with 13 additions and 6 deletions

View File

@@ -561,6 +561,8 @@ class Form
print "\n".'<!-- Input text for third party with Ajax.Autocompleter (select_societes) -->'."\n";
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding">';
print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socid',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), '');
print '<div class="ui-widget">';
if ($socid == 0)
{
//$langs->load("companies");
@@ -570,7 +572,8 @@ class Form
{
print '<input type="text" size="30" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$obj->nom.'" '.$htmloption.' />';
}
print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socid',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), '');
print '</div>';
//print ajax_autocompleter(($socid?$socid:-1),$htmlname,'socid',DOL_URL_ROOT.'/societe/ajaxcompanies.php?filter='.urlencode($filter), '');
print '</td>';
//print '<td class="nobordernopadding" align="left" width="16">';
//print ajax_indicator($htmlname,'working'); // Indicator is here

View File

@@ -94,8 +94,8 @@ function ajax_autocompleter($selected='',$htmlname,$value,$url,$indicator='worki
source: "'.$url.'",
minLength: 2,
select: function( event, ui ) {
jQuery("#'.$htmlname.'").val(ui.item.value);
jQuery("#'.$value.'").val(ui.item.id);
jQuery("#'.$htmlname.'").val(ui.item.socname);
jQuery("#'.$value.'").val(ui.item.socid);
}
});
});';

View File

@@ -82,9 +82,9 @@ if (! empty($_POST['newcompany']) || ! empty($_GET['term']) || ! empty($_POST['i
$resql=$db->query($sql);
if ($resql)
{
while ($row = $db->fetch_array($resql)) {
$row_array['id'] = $row['rowid'];
$row_array['value'] = $row['nom'];
while ($row = $db->fetch_array($resql)) {
$row_array['socname'] = $row['nom'];
$row_array['socid'] = $row['rowid'];
array_push($return_arr,$row_array);
}

View File

@@ -1465,6 +1465,10 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
/* Ajax - Liste deroulante de l'autocompletion */
/* ============================================================================== */
.ui-autocomplete-loading {
background: white url(<?php echo DOL_URL_ROOT.'/theme/eldy/img/working.gif' ?>) right center no-repeat;
}
div.autocomplete {
position:absolute;
width:250px;