Hi Abu. My question is the following. I have two grids. In grid 2, I need to make a "$ g-> get_dropdown_values" for a field ($ col ["formatter"] = "select"), depending on a value in a field in grid 1.
Hi,
You can make grid1 (master) and grid2 (detail grid).
Then pass the param of grid1 that you want in grid2 dropdown query.
Now in grid2 dropdown query, you can pass this param in onload.sql param e.g.
$gender = $_GET["gender"]; // from grid1
$col["editoptions"]["onload"]["sql"] = "select distinct client_id as k, name as v from clients where gender='$gender'";
Hope it help.
How serious is this case? Thank you
$col = array();
$col["title"] = "Comprobante";
$col["name"] = "comprobante";
$col["editable"] = true;
$col["width"] = "120";
$col["editoptions"] = array("size"=>35, "maxlength" => "35");
$col["formatter"] = "autocomplete";
$col["formatoptions"] = array( "sql"=>"SELECT codProveedoresCabecera as k, CONCAT(tl.tipoLetra, ' ',sucursal, ' ',numero, ' ',date_format(fecha, '%d-%m-%Y'), ' ', totalComprobante-totalPagado) as v from proveedorescabeceras pc INNER JOIN tipoletras tl ON tl.codTipoLetra=pc.codTipoLetra", "search_on"=>"numero", "update_field" => "codProveedoresCabecera");
$cols[] = $col;
Abu. The php is a master detail, the master passes as parameters the idVoucher and idProvider. The master detail relation is with idVoucher. The second parameter is to make a filter with $ col ["formatter"] = "autocomplete";
You can pass the master grid param in sql query of autocomplete.
$idVoucher = $_GET["rowid"]; // from grid1
and use this variable in sql query of autocomplete.