Hello,
How can I have a column that is displayed as select for filtering and autocomplete for insert/edit.
The autocomplete list must be filled from another table.
Thanks
Cedric
Hello Abu,
Thanks for the reply but in this demo the autocomplete field still refer to the same table..
// set database table for CRUD operations
$g->table = "vr_deliverie
$col = array();
$col["title"] = "for";
$col["name"] = "d_for";
$col["width"] = "60";
$col["stype"] = "select";
$col["editable"] = true;
$col["editoptions"] = array("value"=>$fill_from_users);
$col["formatoptions"] = array("sql"=>"select uname FROM active_users ORDER BY uname", "update_field"=>"pn_uname");
$col["formatter"] = "autocomplete"; // display label, not value
$col["searchoptions"] = array("value" => ":;".$fill_from_users);
$cols[] = $col;
field d_for, must be an autocomplete textbox filled by the field uname from the table active_users.
When I do this, I have an error:
Couldn't execute query. Unknown column 'd_for' in 'where clause'
Anyway to use a different field name?
Sorry for the delay. Here you need to have search_on param.
e.g.
$col["formatoptions"] = array("sql"=>"SELECT note as k, note as v FROM invheader", "update_field"=>"name","search_on"=>"note");
In your case:
search_on will be the field in active_user table which autocomplete will use in where clause.