Hello, Abu.
I have to create a column with a checkbox field (at least select) to enter in this column the value of another field in the same record.
I studied the dropdown fields of the demo:
$ Str = $ g-> get_dropdown_values ??("select distinct client_id as k, v name as from clients");
$ Col ["editoptions"] = array ("value" => ";". $ Str);
And I adapted to my situation:
for ( $i = 0 ; $i < 10 ; $i ++) {
$col = array();
$col["title"] = "$mes[$i]";
$col["name"] = "justifica_0$i";
$col["width"] = "40";
$col["align"] = "center";
$col["search"] = false;
$col["editable"] = true;
$col["edittype"] = "select"; // render as select
# fetch data from database, with alias k for key, v for value
$str = $g->get_dropdown_values("
SELECT
distinct ROUND((h.ayuda_conc/10),0) as k,
g.pae_gestion,
g.id_gestion,
h.n_pae,
h.ayuda_conc,
ROUND((h.ayuda_conc/10),0) as v
FROM hijos_ayudas h
INNER JOIN
gestion g
ON h.n_pae = g.pae_gestion
WHERE g.id_gestion = '{id_gestion}'
");
$col["editoptions"] = array("value"=>":;".$str);
//$col["formatter"] = "select"; // display label, not value
$cols[] = $col;
);
But the select field displays the option: "undefined"
You can see the complete code in: http://pastebin.com/WSvGw8fS
Please, I need your help,
Thank you
currently get_dropdown_values does not support {id_gestion} placeholder.
You can remove the WHERE condition from this function and add onload-sql option and set the placeholder in that sql.
Refer this code: http://pastebin.com/6pdUdv43