I have to create a select filter to perform a search between multiple select results
<divclass="grupo">
<!-- class="borda select2_single form-control comboauto" -->
<select name="id_projeto" id="id_projeto" class="borda select2_single form-control ">
<option value="">Selecione</option>
<?php
foreach (ProjetoModel::retorna(" order by descricao") as $obj) {
?>
<option value="<?php echo $obj->getid() ?>"
<?php echo $obj->getid()==$vObject->getidProjeto()?'selected':'' ?>>
<?php echo $obj->titulo; ?>
</option>
<?php } ?>
</select>
</div>
Returnfunction
publicstaticfunctionretorna($extra='',$vWhere=null){$arr=array();$sql='SELECT*FROMprojetowhere1=1';$sql.=self::getWhere($vWhere);$sql.=$extra;$vResult=Conexao::getInstance()->query($sql);while($vResult&&$obj=$vResult->fetchObject()){$arr[]=newClassProjeto($obj->id,$obj->titulo,$obj->descricao,$obj->id_net,$obj->id_trafo);}return$arr;}
JAVASCRIPT
<script type="text/javascript">
var config = {
'.chosen-select' : {},
'.chosen-select-deselect' : {allow_single_deselect:true},
'.chosen-select-no-single' : {disable_search_threshold:10},
'.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
'.chosen-select-width' : {width:"95%"}
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}
</script>