Hello Abu,
I am trying to display a drop down list showing all countries like this
$col["formatter"] = "autocomplete"; // autocomplete
$col["formatoptions"] = array("sql"=>"SELECT DISTINCT ShortCountryName as k, Two_letter_CountryCode as v from countrieslist", "update_field"=>"ep_country","search_on"=>"Two_letter_CountryCode");
$str = $g->get_dropdown_values("SELECT DISTINCT ShortCountryName as k, Two_letter_CountryCode as v from countrieslist");
$col["stype"] = "select"; // enable dropdown search
$col["searchoptions"] = array("value" => ":;".$str);
$cols[] = $col;
It only display display the value, not the label (ShortCountryName)
If I reverse ShortCountryName and Two_letter_CountryCode , it display the full country name…
Can you help?
Thanks
Cedric
If you want to show both, and search in both … you can set:
$col["formatoptions"] = array("sql"=>"SELECT DISTINCT ShortCountryName as k, concat(ShortCountryName,' ',Two_letter_CountryCode) as v from countrieslist", "update_field"=>"ep_country","search_on"=>"concat(ShortCountryName,' ',Two_letter_CountryCode)");
It will now display concatenated both fields, and set country name as value of dropdown.
It will also suggest in autocomplete in both fields.
OK that's a work around, but it will not work for me as The value that needs to be entered in the table is the Two_letter_Code only!
Just to understand why then you need to build the dropdown with key and value?