$col = array();
$col["title"] = "IdCliente";
$col["name"] = "IdCliente";
$col["dbname"] = "diario_detalles.IdCliente"; // this is required as we need to search in name field, not id
$col["width"] = "100";
$col["align"] = "left";
$col["search"] = true;
$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 IdCliente as k, Nombre as v from ha_clientes");
$col["editoptions"] = array("value"=>":;".$str);
$col["formatter"] = "select"; // display label, not value
$cols[] = $col;
Hi, I have the following error:
PHP Fatal error: Call to a member function get_dropdown_values () on a non-object
my code, es copy del example
$g->select_command = "select diario_entradas.IdEntrada, diario_entradas. Albaran, diario_entradas.IdCliente , diario_entradas.Contenedor, diario_entradas.Fechallegada FROM diario_entradas inner join ha_clientes on
ha_clientes.IdCliente = diario_entradas.IdCliente";
$grid["width"] = "1200";
// disable all dialogs except edit
// set database table for CRUD operations
$g->table = "diario_entradas";
Please make sure:
1) You are using full version of jqgrid_dist.php (that has full expanded code)
2) $g = new jqgrid() must be defined before using with get_dropdown_values