Card : allow to specify the max displaid rows

This commit is contained in:
Dany De Bontridder 2019-07-22 21:37:16 +02:00
parent 27f5673f2d
commit aa9fe14bf0
3 changed files with 10 additions and 5 deletions

View file

@ -45,6 +45,8 @@ require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
$http=new HttpInput();
$jrn= $http->request("j","number",-1);
$limit=$http->request("limit","number",12);
$filter_card="";
$cn=Dossier::connect();
$d=$http->request('e');
@ -122,7 +124,7 @@ $sql_str="select distinct f_id
join fiche_detail using (f_id)
where
ad_id in (9,1,23)
and ad_value ilike '%'||$1||'%' ".$filter_card.' limit 12';
and ad_value ilike '%'||$1||'%' ".$filter_card.' limit '.$limit;
$fid=$http->request("FID");

View file

@ -653,6 +653,7 @@ class Fiche
$w->width=$r->ad_size;
$w->extra=$filter;
$w->extra2=0;
$w->limit=6;
$label=new ISpan();
$label->name="av_text".$r->ad_id.$uniq."_label";
$fiche=new Fiche($this->cn);
@ -672,7 +673,7 @@ class Fiche
$w->set_attribute('typecard', $filter);
$w->set_attribute('inp', $w->id);
$w->set_attribute('label', $label->name);
$w->autocomplete=0;
$w->autocomplete=1;
$w->dblclick="fill_ipopcard(this);";
$msg=$w->search();
$msg.=$label->input();

View file

@ -135,6 +135,7 @@ class ICard extends HtmlInput
$this->autocomplete=1;
$this->style=' ';
$this->accvis=1; //!< account_visible =1 otherwise 0
$this->limit=12; //!< Max of row show
}
/**
@ -252,14 +253,15 @@ class ICard extends HtmlInput
$div=($this->choice_create==1)?sprintf('<div id="%s" class="autocomplete"></div>',
$this->choice):"";
$query=dossier::get().'&e='.urlencode($this->typecard);
$query=http_build_query([ 'gDossier'=>Dossier::id(),'e'=>$this->typecard,'limit'=>$this->limit]);
$javascript=sprintf('try { new Ajax.Autocompleter("%s","%s","fid_card.php?%s",'.
'{paramName:"FID",minChars:1,indicator:%s, '.
'callback:%s, '.
'limit:%s,'.
' afterUpdateElement:%s});} catch (e){alert(e.message);};',
$this->id, $this->choice, $query, $this->indicator,
$this->callback, $this->fct);
$this->callback, $this->limit, $this->fct);
$javascript=create_script($javascript.$this->dblclick);