Question: is possible to use in the same column
$col[“formatter”] = “autocomplete”;
and
$col[“formatter”] = “select”;
I’ve tried but it doesn’t work:
$col = array();
$col[“title”] = “Responsabile”;
$col[“name”] = “responsabile”;
$col[“editable”] = true;
$col[“editrules”] = array(“number”=>true);
$col[“isnull”] = true;
$col[“formatter”] = “autocomplete”;
$col[“formatoptions”] = array(“sql”=>”SELECT dipendenti.ID_Dipendente, dipendenti.Cognome as v FROM dipendenti”,”search_on”=>”Cognome”,”callback”=>”fill_form”);
$str = $g->get_dropdown_values(“SELECT ID_Dipendente as k, Cognome as v FROM dipendenti”);
$col[“editoptions”] = array(“value”=>$str);
$col[“formatter”] = “select”;
$cols[] = $col;
…
<script>
function fill_form(data)
{
setTimeout(function(){
jQuery(“input[name=responsabile].FormElement”).val(data.ID_Dipendente);
jQuery(“input[name=responsabile].editable”).val(data.ID_Dipendente);
},200)}
</script>
Hi,
Please refer demos/integration/dropdown-select2.php
select2 renders dropdown along with autocomplete feature.