Hi
I need to implement a common tool for many CC_list,
I have explored forum, I've got many clues but not the final solution, I apreciate if someone can help
Goal is to get a simple search input like this
[attachment=0]Captura.JPG[/attachment]
input box is the default srch field input, the issue comes whith dropdown filtering select field:
model.name
model.surname
first choice is a select of filters , because i can easily select filter to use :
but i can't use it because for example 'filter'=> fltr[model][name]='a' just works when field matchs exactly, for example search "a" with filter doesn't get anwer with "angelica" (i don't know if this can be disabled)
Second choice is to use instead "search fields" , it works with incomplete words, but i couldn't find how dinamically select one
search field or another
Any help
but i can't use it because 'filter' fltr[model][name] just works when field matchs exactly, for example search "a" with filter doesnt get anwer with "angelica"
second choice is to use instead "search fields" , it works with incomplete words, but i couldn't find how dinamically select one
search field or another
I need to implement a common tool for many CC_list,
I have explored forum, I've got many clues but not the final solution, I apreciate if someone can help
Goal is to get a simple search input like this
[attachment=0]Captura.JPG[/attachment]
input box is the default srch field input, the issue comes whith dropdown filtering select field:
model.name
model.surname
first choice is a select of filters , because i can easily select filter to use :
fltr[model][name]='a';
fltr[model][surname]='';
but i can't use it because for example 'filter'=> fltr[model][name]='a' just works when field matchs exactly, for example search "a" with filter doesn't get anwer with "angelica" (i don't know if this can be disabled)
Second choice is to use instead "search fields" , it works with incomplete words, but i couldn't find how dinamically select one
search field or another
Any help
but i can't use it because 'filter' fltr[model][name] just works when field matchs exactly, for example search "a" with filter doesnt get anwer with "angelica"
second choice is to use instead "search fields" , it works with incomplete words, but i couldn't find how dinamically select one
search field or another
Good news I have got something working, but not sure if can be improved 😀
in front->list display a select dropdown with some fixed fields(most important filters)
and in Model->conditions the dynamically filtered search:
$filtername: gets the field to be filtered (look into select fields that quotation for SQL has to be included into them,
$filtertext: gets the text to be searched
in front->list display a select dropdown with some fixed fields(most important filters)
<?php
$keys= array(0=>'',1=>'`nombre`',2=>'`apellidos`',3=>'`nif`',4=>'`ciudad`',5=>'`provincia`',6=>'`codpostal`',7=>'`tarifaname`');
$values= array(0=>'Seleccione', 1=>'Nombre',2=>'Apellidos',3=>'Nif',4=>'Ciudad',5=>'Provincia',6=>'Codpostal',7=>'Tarifa');
$options = array_combine($keys, $values);
$field = array (
'name' => 'filtername', 'id' => '', 'options' => array ( ),
'empty' => '', 'values' => array ( ), 'label' => array ( 'text' => 'Filtro1', 'position' => 'top', ),
'sublabel' => '', 'multiple' => '0', 'size' => '', 'class' => '', 'title' => '', 'style' => '', 'params' => '', ':data-load-state' => '',
':data-tooltip' => '', 'type' => 'dropdown', 'container_id' => '0',);
$field["options"] = $options;
echo \GCore\Helpers\Html::formLine($field["name"], $field);
?>
<div class="gcore-subinput-container-wide" id="fitem-text1"> <div class="gcore-input-wide pull-left gcore-sub-input gcore-display-table" id="fin-text1"><input name="filtertext" id="text1" value="" placeholder=".." maxlength="" size="60" class="form-control A" title="" style="" data-inputmask="" data-load-state="" data-tooltip="" type="text" /></div></div>
<div class="form-group gcore-form-row" id="form-row-1"><div class="gcore-input gcore-display-table" id="fin-button3">
<input name="button3" id="button3" type="submit" value="Filtrar" class="form-control A" style="" data-load-state="" /></div></div>
and in Model->conditions the dynamically filtered search:
$filtername: gets the field to be filtered (look into select fields that quotation for SQL has to be included into them,
$filtertext: gets the text to be searched
<?php
if(isset($_POST['filtername']) && isset($_POST['filtertext'])){
$dbo = \GCore\Models\bol::getInstance()->dbo;
$filter =$_POST['filtername'];
$text=$_POST['filtertext'];
return array(":{$filter} LIKE" => "%{$text}%");
}
?>
This topic is locked and no more replies can be posted.